Below is my code :
p = (float *) malloc(sizeof(float) * n);
p1 = p; // p1 is float*
p--; // Will this result in a seg-fault?
I am guessing yes because I am trying to access memory outside allocated space. Please could somebody confirm?
Edit
After seeing hobbs' answer I could not resist asking this too.
I strongly believe this will not result in a seg fault
printf("%f",p[n]); // because n is legally allocated for p