Explanatory Question
How to read and write data in an array?
Read the answer carefully and go through the related questions on the right side to improve your understanding of this topic.
In this section you will learn how to read and write data in an array using c programming Language
#include int main() { int array[10], n, i; // Reading array size printf("Enter size of the array (max 10): "); scanf("%d", &n); // Reading array elements printf("Enter array elements:\n"); for (i = 0; i < n; i++) { scanf("%d", &array[i]); } // Writing (printing) array elements printf("Array elements are:\n"); for (i = 0; i < n; i++) { printf("%d ", array[i]); } return 0; }
First read the answer fully, then try to explain it in your own words. After that, open a few related questions and compare the concepts. This method helps you remember the topic for a longer time and improves exam preparation.