#include"conio.h"
#include"stdlib.h"
void main()
{
int* a,n,i;
clrscr();
printf("how many numbers you want to enter");
scanf("%d",&n);
a=(int*)malloc(n*sizeof(int)); // calloc can be used as //a=(int*)calloc(n,sizeof(int));
printf("\nenter the numbers\n");
for(i=0;i
scanf("%d",a+i);
}
printf("enter a new value for n");
scanf("%d",&n);
a=(int*)realloc(a,n*sizeof(int));
printf("the entered numbers are");
for(i=0;i
printf("%d\n",*(a+i));
}
getch();
}
No comments:
Post a Comment