What will be the output of the following code?#include <stdio.h>#include <string.h>int main() { char str1[] = "Hello"; char str2[10]; strcpy(str2, str1); printf("%s\n", str2); return 0;}
Question
What will be the output of the following code?#include <stdio.h>#include <string.h>int main() { char str1[] = "Hello"; char str2[10]; strcpy(str2, str1); printf("%s\n", str2); return 0;}
🧐 Not the exact question you are looking for?Go ask a question
Solution
The output of the code will be "Hello".
Here's the step by step explanation:
- The code starts with including two libraries, stdio.h for
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.