Multiple choice

char buf [] = Hello world!; char * buf = Hello world!; In terms of code generation, how do the two definitions of buf, both presented above, differ?

  1. The first definition certainly allows the contents of buf to be safely modified at runtime while the second definition does not.

  2. The first definition is not suitable for usage as an argument to a function call but the second definition is.

  3. The first definition is not legal because it does not indicate the size of the array to be allocated while the second definition is legal.

  4. They do not differ -- they are functionally equivalent.

  5. The first definition does not allocate enough space for a terminating NUL-character, nor does it append one while the second definition does.

Reveal answer Fill a bubble to check yourself
D Correct answer