Qualcomm interview question

static variables

Interview Answer

Anonymous

Jul 6, 2013

static variables are stored in the data segment (as opposed to the stack). They are primarily used in functions that are called multiple times. In this situation a static variable is itialized one time and each call to the function would update the same variable. Thus the static variable is shared by all calls to this function.