Question
#include <stdio.h>
#include <stdlib.h>
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.
Posted under C Programming
Engage with the Community - Add Your Comment
Confused About the Answer? Ask for Details Here.
Know the Explanation? Add it Here.
Q. Consider the following program. Where are i, j and k are stored in memory?
Similar Questions
Discover Related MCQs
Q. Where does the uninitialized data gets stored in memory?
View solution
Q. malloc() returns a NULL if it fails to allocate the requested memory.
View solution
Q. If malloc() successfully allocates memory it returns the number of bytes it has allocated.
View solution
Q. Can We increase the size of dynamically allocated array?
View solution
Q. Can we increase the size of statically allocated array?
View solution
Q. When we dynamically allocate memory is there any way to free memory during run time?
View solution
Q. Local variables are stored in an area called ___________
View solution
Q. Choose the statement which is incorrect with respect to dynamic memory allocation.
View solution
Q. The type of linked list in which the node does not contain any pointer or reference to the previous node:
View solution
Q. The advantage of using linked lists over arrays is that ________
View solution
Q. Which of the following is an example for non linear data type?
View solution
Q. Why to use fflush() library function?
View solution
Q. Why is calloc() function used for?
View solution
Q. Which is the correct sequence of compilation process?
View solution
Suggested Topics
Are you eager to expand your knowledge beyond C Programming? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!