| array-limitations-1-with-for.c - A solution: Copy the array in a for loop. | Lecture 1 - slide 20 : 34 Program 9 |
#include <stdio.h>
int main(void) {
double a[10], b[10];
int i, j;
for(i = 0; i < 10; i++) /* Initialization */
a[i] = i;
for(j = 0; j < 10; j++) /* Copy a to b */
b[j] = a[j];
for(i = 0; i < 10; i++)
printf("b[%d] = %f\n", i, b[i]);
return 0;
}