I have a question for you. I was reading some information about pointer in c and memory allocation, and I saw a little program which create an error when it runs:
#include <stdio.h>
char* getname(void){
    char nstring[25];
    printf("Please type your name");
    gets(nstring);
    putchar('\n')
    return nstring; //Serious error in this program
}
int main(void){
    char* myname;
    myname = getname();
    printf("%n\n", myname);
    return 0;
}
Why is there a comment in the code that says "Serious error in this program" ? I do not understand where the error is happening. Can someone explain it to me ?
 
     
    