C language

Q5: Memory allocation

As address of the variable y is returned and which gets stored in x and the memory block of function abc() is de-allocated. Next we try to store a value in the memory which has been de-allocated. As memory has been de-allocated and hence operating system may have allocated this memory to some other process. […]

C language

Q4: Memory Allocation

What is the output of the following code? (a) 3              (b) 5       (c) Can’t say Ans: Many would answer it as 3 but it is wrong. The way we have tried to do it is wrong. As we enter into main we have a memory allocated for variable x and then function abc is called. Now […]

C language

Q3: Memory allocation

Consider the C code Explain the allocation of memory in stack for the above program. Ans: firstly a frame in stack is created and memory is allocated to store variable x with value 3. And then function call is made to function fun() and a new frame is created in the stack. Firstly return address to […]