Okay in the following code
For any string with length > 8, the program crashes. Someone please tell me why that happens!!Code:#include<stdio.h> #include<string.h> #include<stdlib.h> struct mystruct { int a; char * string; }; struct mystruct mystruct1; int main() { mystruct1.string=(char *)malloc(sizeof(char)); strcpy(mystruct1.string,"ljgls;dd"); printf("Here"); return 0; }
Thanks!