The following code initializes the values in the array sequentially and then prints them out:

#include <stdio.h>

int main()
{
    int a[5];
    int i;

    for (i=0; i<5; i++)
        a[i] = i;
    for (i=0; i<5; i++)
       { printf("a[%d] = %d\n", i, a[i]);}
     getchar();
  
}



Next Page >>
<< Back to Electronics