C Programming Fundamentals

Casual Mode - Take your time!

1 / 19
Correct
0
Incorrect
0
Score
0%
Multiple Choice

What would be the output of the following program?

main()
{
char *str,*str1="I Love You";
str=malloc(strlen(str1));
strcpy(str,str1);
printf("%s",str);
free(str);
}

  1. free() fails
  2. I Love You
  3. malloc() fails
  4. strcpy() fails
Change Mode