Machine-translated by Google. Questions are authored in English.
Top

Discussion

A variable declared static inside a function

  • A.is created afresh on every call
  • B.is shared with every other function in the file
  • C.is placed on the stack like any other local
  • D.retains its value between calls

Answer: D

It has static storage duration, so it lives for the whole program and keeps its value from one call to the next. That also makes the function non-reentrant, which matters if it may be called from a task and a handler both.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.