ProgrammingModerateTCS NQT · Wipro

Which of the following is NOT allowed in C?

  1. A. Assigning one struct to another of the same type with =
  2. B. Assigning one array to another with =
  3. C. Passing a struct that contains an array by value
  4. D. Returning a struct from a function

Correct answer: B. Assigning one array to another with =

An array name is not a modifiable lvalue, so a = b; between arrays does not compile; you must use memcpy or a loop. Structs, even ones containing arrays, can be assigned, returned and passed by value, which copies the whole thing.

More C Programming questions

Exams that ask this topic