Warning: implode(): Invalid arguments passed in /www/wwwroot/jobquiz.info/mdiscuss.php on line 336 What will be the output of the program ? #include<stdio.h> int main() { char str[] = "Nagpur"; str[0]='K'; printf("%s, ", str); str = "Kanpur"; printf("%s", str+1); return 0; } ?->(Show Answer!)
1. What will be the output of the program ? #include<stdio.h> int main() { char str[] = "Nagpur"; str[0]='K'; printf("%s, ", str); str = "Kanpur"; printf("%s", str+1); return 0; }
Ask Your Doubts Here
Comments
By: guest on 01 Jun 2017 06.02 pm
The statement str = "Kanpur"; generates the LVALUE required error. We have to use strcpy function to copy a string. To remove error we have to change this statement str = "Kanpur"; to strcpy(str, "Kanpur"); The program prints the string "anpur"