How to display all elements of an array in the C langua…
In C language, we can loop through each element of an array and use the printf function to output each element on the screen.
Here is a sample code:
#include<stdio.h>
int main() {
int arr[] = {1, 2, 3, 4, 5};
int length = sizeof(arr) / sizeof(arr[0]);
for(int i = 0; i < length; i++) {
printf("%d ", arr[i]);
}
return 0;
}
The output will be: 1 2 3 4 5