top of page



#include <stdio.h>

struct node{

int data;

struct node *next;

};


struct node *head,*newnode;

int choice;


void main() {

printf("\n----Insertion At Beginning----");

struct node *temp;

do

{

newnode = (struct node *)malloc(sizeof(struct node));

printf("\nEnter data : ");

scanf("%d",&newnode->data);

newnode->next=head;

head=newnode;

printf("\nEnter your choice : (0/1) ");

scanf("%d",&choice);

}while(choice);

temp=head;

printf("\n");

while(temp!=0)

{

printf("--%d", temp->data);

temp=temp->next;

}

}

Updated: Mar 9, 2023


In C programming, an array is a collection of elements of the same data type, such as integers, characters, or floating-point numbers, stored in contiguous memory locations.

Each element in an array is identified by an index or a subscript, which is a non-negative integer value that starts from zero and goes up to the size of the array minus one.

Arrays are useful for storing and manipulating large amounts of data efficiently. They can also be used to represent tables, matrices, and other multi-dimensional data structures.

In C, you can declare an array by specifying the data type of its elements, followed by its name, and its size in square brackets, like this:


int numbers[5];

numbers[0] = 10; numbers[1] = 20;


int numbers[5] = {10, 20, 30, 40, 50};



#include <stdio.h>


void main() {

int a[100],i;

int eb,size,pos;

printf("\nEnter the size of array : ");

scanf("%d",&size);

for(i=0;i<size;i++)

{

printf("\nEnter element : ");

scanf("%d",&a[i]);

}

printf("\n----Array----\n");

for(i=0;i<size;i++)

{

printf(" %d",a[i]);

}

printf("\nEnter position of element : ");

scanf("%d",&pos);

for(i=pos-1;i<size;i++)

{

a[i]=a[i+1];

}

size--;

printf("\n----Latest Array----\n");

for(i=0;i<size;i++)

{

printf(" %d",a[i]);

}

printf("\nSize : %d",size);

}

bottom of page