Top

Discussion

Consider the following program, where are i, j and k are stored in memory?

int i;
int main()
{
    int j;
    int *k = (int *) malloc (sizeof(int));
}

 

  • A.i, j and *k are stored in stack segment
  • B.i and j are stored in stack segment. *k is stored on heap
  • C.i is stored in BSS part of data segment, j is stored in stack segment. *k is stored on heap
  • D.j is stored in BSS part of data segment, i is stored in stack segment. *k is stored on heap

Answer: C

No answer description available for this question.

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

Post your comment