391 views
0 votes
0 votes

This code executes successfully

int main() {

char str[20];

gets(str);

puts(str);

return 0;

}

whereas the below code gives runtime error

int main() {

char *str;

gets(str);

puts(str);

return 0;

}

why so?

Please log in or register to answer this question.

No related questions found