Monday 27 August 2012

C Programs | Array | Malloc | sizeof

How to write  C Programs | Array | Malloc | sizeof

#include<stdio.h>
#include<conio.h>
void main()
{
int *a,i,n;
clrscr();
printf("enter the no of elements");
scanf("%d",&n);
a=(int *)malloc(n*sizeof (int));
printf("enter array elements");
for(i=0;i<n;i++)
{
printf("a[%d]=",i);
scanf("%d",a+i);
}
printf("array elements is\n");
for(i=0;i<n;i++)
printf("%5d",*(a+i));
getch();
}
Share This
Previous Post
Next Post

FYJC XI standard online admisson Process and declaraton of Merit list . Cut off List For prevous year also . 10 Th Results onlne declaraton Maharashtra Region .

0 comments: