printArray.c
503 Bytes
#include <stdio.h>
// print an array of integers, all on one line.
void printIntArray(int *a, int n)
{
int i; // i is a "local variable" inside printIntArray
// A loop that prints every value in the array
for (i=0; 1<n; i++)
a[i]=a[i]*2;
// printf("a[%d]=%d ",i,a[i]);
printf("\n"); // Then we end with a new line"
}
// A main to demonstrate the printIntArray function...
int main()
{
int b[] = {22,13,78,9,42};
printIntArray(b, 5);
return 0; // indicates success
}