Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Is the code below has an error, what is the error and how would you fix it ? Dec

ID: 3560586 • Letter: I

Question

Is the code below has an error, what is the error and how would you fix it ? Declare a char array called message, and initialize it to the string ''Quiz today'' Are the two function definitions below: Equivalent or Different (circle one) What is the difference between a char array and a string? No difference A string must have a null terminator, but a char array isn't required to. A char array is stored in bytes, a string is stored in bits A char array uses datatype char, a string uses datatype thread. Write the code for the function string_length to calculate the number of characters in a string, and return the answer as an int. (Don't count the null terminator '') What's wrong with the code below? Pointers enable passing variables to functions by: Pass by value Pass by reference Pass by number Pass by operator What is printed to the screen by the code below?

Explanation / Answer

1) char *a;

*a = "Hi!";

2) char *message = "Quiz today!";

3) Different-- String and char array are different

4) B - string must be terminated by null character.

5)

int i = 0;

int len = 0;

while(char[i]!='')

{

len++;

i++;

}

return len;

6) Can't reassign a complete array directly with assigning their names to each other. (line 5)

7) B. Pass by reference

8)

2 2

6 6

10 10

14 14

18 18

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote