This following code produces output as 8 4 4.

8 is fine, as the size of an int plus a pointer is 8, but why the size of p and 
q is being shown as 4?

#include<stdio.h>#include<stdlib.h>int main(){
    struct node
    {
           int data;
           struct node * link;       
    };
    struct node *p, *q;
    printf("%d ", sizeof(struct node));
    p = (struct node *)calloc(sizeof(struct node) , 1);
    q = (struct node *)calloc(sizeof(struct node) , 1);
    printf("%d %d", sizeof(p), sizeof(q));
    getchar();}

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/8bw2jFtQHBsJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to