P182. Program to allocate dynamic memory for ‘n’number of integers, scan it and print it
#include<stdio.h>
#include<stdlib.h>
void
main()
{
int *p,i,n;
printf("Enter the size : ");
scanf("%d",&n);
p=malloc(sizeof(int)*n);
printf("Enter the integer :
\n");
for(i=0;i<n;i++)
scanf("%d",&p[i]);
printf("\n");
for(i=0;i<n;i++)
printf("%d\n",p[i]);
}
Comments
Post a Comment