Q:

What should be the output of this following code snippet and why?

What should be the output of this following code snippet and why?
     #include <stdio.h>
     #include <string.h>
     int main()
     {
        char ch = 'A';
        char str[3];
        strcpy(str, "ABCDE");
        printf("%c", ch);
      }

A:

The output of this program could be anything because you overrun the buffer str and get undefined behavior.  In fact, the program might not output anything, it might crash, or it might do something far worse.

