On Tue, Jul 26, 2011 at 1:43 AM, Nitish Garg <[email protected]>wrote:
> 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();}
>
> because p and q are pointers. Note an object.
> 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 [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.