I am trying to allocate the memory of 1KB of size to two variables. I treied with for loop, but i am getting segmentation fault error. I have attached my sample code below. can anyone help to find why that error occurs and whats the solution for my problem
"Thanks in advance"Code:#include<stdio.h> #include<stdlib.h> main() { int i,*par[i]; for(i=0;i<=2;i++) { par[i]=(int *)malloc(1024); printf("\n%u",par[i]); } free(par); }