Skip to content

Instantly share code, notes, and snippets.

@LokeshKumarES
Last active March 12, 2022 15:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LokeshKumarES/529b6905c696676537e76803310f4336 to your computer and use it in GitHub Desktop.
Save LokeshKumarES/529b6905c696676537e76803310f4336 to your computer and use it in GitHub Desktop.
C Array, What are Arrays in C. Properties, Advantages, Disadvantages, Declaration and Initialization of Arrays.
#include<stdio.h>
int main(){
int i=0;
//method 1: declaration of array
//int marks[5];
//method 2: declaration with initialization of array
int marks[5] = {80, 60, 70, 85, 75};
//method 3: declaration with initialization of array
//int marks[] = {80, 60, 70, 85, 75};
//method 4: initialization of array
marks[0]=80;
marks[1]=60;
marks[2]=70;
marks[3]=85;
marks[4]=75;
//traversal of array
for(i=0;i<5;i++){
printf("%d \n",marks[i]);
}//end of for loop
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment