Tag Archives: C code for array input

A C Code to Input array and print the same

Input array and print the same.

Explanation :

we can access element in array using array name and [ ]. Just specify the position within square bracker [ ] just after the array variable name.

Here we have defined int array of size 100. We have defined size variable which can go max upto 100 (because array size max can reach upto 100). Then we have taken size as input using scanf function then we have initialized for loop from zero because array starts default from zero in C. We will  run the loop upto size-1 which is controlled by (i<size) . In the body part of for loop we have given arr[i] as argument in scanf function, to store value from input into arr[i] untill loop gets terminated.

After inputting array we are printing array using for loop.

Input array and print the same code in C.