1D Array is Also called as One Dimensional Array , Which Means Array or a Matrix with only with Single Row .
Array is To be Consider As The Linear Data Structure . That Means The Element In Array Is Store ate Contiguous Memory Location or In Sequential Order.
Syntax for Creating 1D - Array :
Algrothim :
Follow
the steps to Create the 1d Array without taking user’s input
Step 1 : Initialize
the counter ( i.e. i = 0 ) and
Array with Element size and value
Step 2 : Display the Statement
Step 3 :
Start the for [ LOOP ] from 0 till 10 …
Step 4 :
Display the Element of Array at
given index from i
Step 5 : Increment the Counter ( i ) with 1
Step 6 : [ END LOOP ]
Step 7 : Stop
Code :
Output :
Executable Code :
//
Creating the 1d Array
#include<stdio.h>
// Declaring the standard Input and Output
//
Creating the Main where the execution will Take Place and will resturn
Something
int
main()
{
int i; // creating a Counter
int arr[20]=
{1,2,3,4,5,6,7,8,9,1}; // creating the array of 10 elements
// creating the loop for printing
the values
printf(" 1D Array
\n\n"); // displaying 1D Array
for(i=0;i<10;i++)
{
printf("%d
\t",arr[i]); // Printing The Array
using gor loop
}
return 0;
}
How to Call or Display / Print The Array :
For Printing the Array You have to follow the Syntax :
If You want to print Multiple Element Then use For Loop to print , Simply use the Print Statement in C programming , Example :
Operations Performed On 1D- Array :
1) Creating Array
2) Traversal of Array
3) Deletion of Array
4) Searching
5) Sorting (in Ascending and Descending Order )
6) Merging Array