#include<stio.h> main() { int *p,i; p = (int*)malloc(sizeof(int)); printf("Enter:"); scanf("%d",p); for(i=1;i<3;i++) { printf("Enter"); scanf("%d",p+i); } for(i=0;i<3;i++) { printf("No:%d\n",*(p+i)); } getch(); return 0; }
In this C program memory is accessed without allocation.The program works.Will any problem arise by accessing memory without allocation?If yes then what is the solution for storing a collection of integer data which the size is not known in advance?