C Programming - Structures, Unions, Enums - Discussion

Discussion Forum : Structures, Unions, Enums - Find Output of Program (Q.No. 9)
9.
What will be the output of the program in 16-bit platform (under DOS)?
#include<stdio.h>

int main()
{
    struct node
    {
        int data;
        struct node *link;
    };
    struct node *p, *q;
    p = (struct node *) malloc(sizeof(struct node));
    q = (struct node *) malloc(sizeof(struct node));
    printf("%d, %d\n", sizeof(p), sizeof(q));
    return 0;
}
2, 2
8, 8
5, 5
4, 4
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
36 comments Page 4 of 4.

Abhinay said:   1 decade ago
How much space will struct node will occupy?

Ashish said:   8 years ago
Yes, Agree @Hardik.

It's 8,8 for 64 bit.

Hiriyo said:   1 decade ago
I am with you mohansai you are right.

Amandeep Singh said:   7 years ago
As per me, the answer is 8, 8.

RAJI said:   9 years ago
Thank you so much @Chandresh.
(1)

Satyaprakash said:   1 decade ago
Thank you for Sundar.


Post your comments here:

Your comments will be displayed after verification.