Arrays C Programs
C Program to specify two dimension array.
/*Program using two dimension array */
#include <stdio.h>
main()
{
/* Local definitions */
int stud[4][2]; /*An array name with 4 rows and 2 columns */
int i;
/* Statements */
for(i=0;i<=3;i++)
{
printf("\n Enter the %d Student roll no and Mark:",i);
scanf("%d %d", &stud[i][0], &stud[i][1]);
} /* for */
for(i=0;i<= 3;i++)
printf("%d Students roll no %d mark %d", i, stud[i][0], stud[i][1]);
} /* main */
OUTPUT
Enter the 0 student roll no and mark: 3977 80
Enter the 1 student roll no and mark: 17776 95
Enter the 2 student roll no and mark: 6682 82
Enter the 3 student roll no and mark: 6683 85
0 student roll no 3977 mark 80
1 student roll no 17776 mark 95
2 student roll no 6682 mark 82
3 student roll no 6683 mark 85
EXPLANATION: Look at the scanf() statement used in the first for loop in the above example. In stud[i][1] and stud [i][1] the first subscript of the variable stud, is row number which changes for every student. The second subscript tells the column number. The following diagram shows how the data is stored in the memory.
Note that all data stored in continuous memory location.

i.e., 3977 is stored in stud [0][0], 80 is stored in stud [0][1] and so on. In fact two dimensional array is nothing but a collection of a number of one dimensional arrays placed one below the other.
Computer Programming C Laboratory: Arrays C Programs : Tag: C Programming : - C Program to specify two dimension array
Computer Programming C Laboratory
CS25C01 1st Semester EEE, ECE, CSE, CSE(CY), AIDS, IT practical Laboratory Manual | 2025 Regulation | 1st Semester Laboratory 2025 Regulation
English Essentials I
EN25C01 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation
தமிழர் மரபு - Heritage of Tamils
UC25H01 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation
Applied Calculus
MA25C01 Maths 1 M1 - 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation
Applied Physics I
PH25C01 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation
Applied Chemistry I
CY25C01 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation
Makerspace
ME25C04 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation
Computer Programming C
CS25C01 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation
Computer Programming Python
CS25C02 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation
Fundamentals of Electrical and Electronics Engineering
EE25C03 1st Semester EEE Depart | 2025 Regulation | 1st Semester 2025 Regulation
Introduction to Mechanical Engineering
ME25C03 1st Semester Mechanical Dept | 2025 Regulation | 1st Semester 2025 Regulation
Introduction to Civil Engineering
CE25C01 1st Semester Civil, Agri Departments | 2025 Regulation | 1st Semester 2025 Regulation
Essentials of Computing
CS25C03 1st Semester - AIDS, CSE, CSE(CY), IT Department | 2025 Regulation | 1st Semester 2025 Regulation
Applied Physics I Laboratory
PH25C01 1st Semester practical Laboratory Manual | 2025 Regulation | 1st Semester Laboratory 2025 Regulation
Applied Chemistry I Laboratory
CY25C01 1st Semester practical Laboratory Manual | 2025 Regulation | 1st Semester Laboratory 2025 Regulation
Computer Programming C Laboratory
CS25C01 1st Semester EEE, ECE, CSE, CSE(CY), AIDS, IT practical Laboratory Manual | 2025 Regulation | 1st Semester Laboratory 2025 Regulation
Computer Programming Python Laboratory
CS25C02 1st Semester practical Laboratory Manual | 2025 Regulation | 1st Semester Laboratory 2025 Regulation
Engineering Drawing
ME25C01 EEE, Mech, Agri, EEE Depts | 2025 Regulation | 2nd Semester 2025 Regulation
Basic Electronics and Electrical Engineering
EE25C04 1st Semester ECE Dept | 2025 Regulation | 1st Semester 2025 Regulation
Essentials of Computing - Laboratory
CS25C03 1st Semester AIDS, CSE, CSE(CY), IT Depts | practical Laboratory Manual | 2025 Regulation | 1st Semester 2025 Regulation