What will be the output of the following code?#include <stdio.h>int main() { char str[] = "Hello"; str[0] = 'M'; printf("%s\n", str); return 0;}
Question
What will be the output of the following code?#include <stdio.h>int main() { char str[] = "Hello"; str[0] = 'M'; printf("%s\n", str); return 0;}
🧐 Not the exact question you are looking for?Go ask a question
Solution
The output of the code will be "Mello".
Here's the step by step explanation:
-
The code starts with including the standard input/output library of C, which allows the use of input/output functions.
-
The main function is declared, which is the entry point of the program.
-
Inside the main function, a
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.