Question: undefined QUESTION 7 Consider this code fragment which is trying to build a string by hand: char buff[3]; buff[1] = 'x'; buff[2] = 'y'; buff[3]

![a string by hand: char buff[3]; buff[1] = 'x'; buff[2] = 'y';](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f2fb8479b73_13266f2fb8417e9e.jpg)
undefined
QUESTION 7 Consider this code fragment which is trying to build a string by hand: char buff[3]; buff[1] = 'x'; buff[2] = 'y'; buff[3] = 'z'; 0 000 Are there any problems with this code? Check all that apply The data type is incorrect There is a buffer overflow The string is not NULL-terminated The first array entry is not initialized. QUESTION 5 Consider the following code: O O O O O char buff [100]; printf ("Enter word: "); scanf("%s", buff); We want to test if the user entered the word Hello. This of the following code fragments is correct? O if (buff.equals("Hello")) { ... } if (buff = "Hello") { ... } if (strcmp(buff, "Hello") == 0) { ... } if (strcmp(buff, "Hello")) { ... } if (buff == "Hello") { ... } QUESTION 8 Consider this code: y; }; struct pair { int x, struct pair z; void func() { struct pair y; struct pair *x = (struct pair *) malloc(sizeof(struct pair)); } Match each of the variables with the memory segment it is assigned. Az A. heap memory B. stack memory 4 x C. global memory
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
