Practice mode C Language

Which operation is not allowed on a variable declared with the register storage class in C?

Correct answer D. Taking its address with the & operator

Explanation

register is only a hint that the variable will be used heavily, but the language rule is strict: you may not apply the unary & operator to it, and a register array cannot be converted to a pointer. Assigning, reading and passing its value are all fine. Modern compilers allocate registers themselves, so the keyword mostly survives in old code.

Report a problem

Answer checked How we write and check questions

Tip: press A, B, C or D to answer, and N for the next question.

Advertisement

Have a question about this answer?

Your email address will not be published. Required fields are marked *

Links and website addresses are not allowed in comments.