Question: In the following code, what is the output of printf()? 1:#include 2:#include 3:#include 4:int main(void) 5:{ 6: char *str1 = NULL, *str2 = NULL; 7:

In the following code, what is the output of printf()?

1:#include

2:#include

3:#include

4:int main(void)

5:{

6: char *str1 = NULL, *str2 = NULL;

7: int slen1 = 5, slen2 = 5;

8: str1 = malloc(sizeof(char) * (slen1 + 1));

9: str2 = malloc(sizeof(char) * (slen2 + 1));

10: strcpy(str2, "Navid");

11: strcpy(str2, "Navid");

12: if (str1 == str2)

13: printf("(a)");

14: if (strcmp(str1, str2) == 0)

15: printf("(b)");

16: if (!strcmp(str1, str2))

17: printf("(c)");

18: return 0;

19:}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!