c how to print out an array code example
Example 1: print an array in c
int array[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0};
int i;
for (i = 0; i < 10; i++) {
printf("%d ", array[i]);
}
Example 2: how to print a pointer array in c
#include <stdio.h>
int main() {
int data[5];
printf("Enter elements: ");
for (int i = 0; i < 5; ++i)
scanf("%d", data + i);
printf("You entered: \n");
for (int i = 0; i < 5; ++i)
printf("%d\n", *(data + i));
return 0;
}