Pages

Friday, 8 February 2019

Program to illustrate One Dimensional Array

one dimensional array:
              An array which has only one subscript is known as one dimensional array i.e) int a[5].

Syntax
data_type varname[size];

Declaration of an array program :
              In C programming, programmers can also initialize the array variable without mentioning the size of an array. The compiler will automatically  deduct the size of an array.

declaration-1
int student[5] = {89, 76, 98, 91, 84};

declaration-2
int student[] = {89, 76, 98, 91, 84};


Program:
#include <stdio.h>
int main()
{
int s[5] = {89, 76, 98, 91, 84}, i;
printf("\n---Students marks details--- ");
for(i = 0; i < 5; i++)
{
printf("\ns%d = %d ", i + 1, s[i]);
}
return 0;
}

output;

No comments:

Post a Comment

Programs in turboc3 : Files

File Handling in C File Handling concept in C language is used for store a data permanently in computer. Using this concept we can store our...