Single Dimensional Array Example Program in C Programming
Definition
An array is a collection of data that holds homogeneous values. That means values should be in same type
Syntax
type variable_name[size]
Details of Array
int varName[10];
Here, varName has 10 containers,
varName[0], varName[1] to varName[9]
For example,
Array values stores like below structure,
int value[6] = {5,10,15,20,25,30};
Value[0] = 5
Value[1] : 10
Value[2] : 15
Value[3] : 20
Value[4] : 25
Value[5] : 30
Example Program for Single Dimensional Array
/* Example Program For Single Dimensional Array In C Programming Language
little drops @ thiyagaraaj.com
Coded By:THIYAGARAAJ MP */
// Header Files
#include<stdio.h>
#include<conio.h>
int main()
{
int i;
// declaring and Initialising array in C
int value[6] = {5,10,15,20,25,30};
for (i=0;i<6;i++)
{
// Accessing each variable using for loop
printf("Position : [%d] , Value : %d \n", i, value[i]);
}
// Wait For Output Screen
getch();
//Main Function return Statement
return 0;
}
Sample Output:
Position : [0] , Value : 5
Position : [1] , Value : 10
Position : [2] , Value : 15
Position : [3] , Value : 20
Position : [4] , Value : 25
Position : [5] , Value : 30
C Array Programs
- Single Dimensional Array Example Program in C Programming
- Sum of Array C Example Program
- Read Array and Print Array C Example Program
- Find Largest or Biggest Number In Array C Example Program
- Simple Sorting In Array C Example Program
- Simple Sorting Descending Order In Array C Example Program
- Simple Searching In Array C Example Program
- Simple C Program for Find Array Size
- Matrix Addition 2 D (dimensional) Array Example Example Program
- Matrix Subtraction 2 D (dimensional) Array Example Example Program
- Matrix Multiplication 2 D (dimensional) Array Example Example Program
Read More Articles
- Use of getch(),getche() and getchar() in C
- Switch Case Statement Example Program In C Programming Language
- C Character Set
- Convert a Floating-point value to an Integer in C
- Data Input and Output gets and puts Example Program In C
- Special Operators In C
- Pointer Representation and Pointer Example Programs
- C Data Input and Data Output
- Simple While Loop Example Program In C Programming Language
- Data Output printf and putchar Example Program In C
- C Introduction
- C Operators
- Storage Classes In C
- C Pointers
- File Management
- C Identifiers
- Loop Control Statements
- Hello World - Simple C Program
- C Array
- Single Character Output Function : putchar()
- C Reserve Words
- C Specific Properties and Implementation
- If else Statement Example Program In C Programming Language
- If Statement Example Program In C Programming Language
- Confusing Array in C ( Array Representation and Initialization )