I am using an array and I tried this code:
#include <stdio.h>
#include <stdlib.h>
int main()
{
char **q = (char*)malloc(1*sizeof(char*));
q[0]="So Many Books";
q[1]="So Many Books";
q[2]="So Many Books";
q[3]="So Many Books";
q[4]="So Many Books";
printf("%s\n",q[0]);
printf("%s\n",q[1]);
printf("%s\n",q[2]);
printf("%s\n",q[3]);
printf("%s\n",q[4]);
return 0;
}
Why is the compiler not giving me an error here? I only have booked a place for one string out of an array of strings.
I have looked to some resources like: