How to Print an Array in C Programming Language

This program will read an array and print that array as output. In this program, we have used the for loop to print all elements of an array. When you execute this program, It will ask to enter the number of array elements and then take elements as input and store in an array variable.

Let assume if you enter the number of elements as 2, then you need to enter two elements as input. see the below program output.

c program to read an array

Copy the below c program and execute it with the help of c compiler.

Program Output:

Enter no of elements :2
Enter the values :50
arr[0] = 50
arr[1] = 90

If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.

Recommended Posts:

Article Tags: , , , , ,