Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


main()

{

char *p;

printf("%d %d ",sizeof(*p),sizeof(p));

}

Answers were Sorted based on User's Feedback



main() { char *p; printf("%d %d ",sizeof(*p),sizeof(p)); }..

Answer / susie

Answer :

1 2

Explanation:

The sizeof() operator gives the number of bytes
taken by its operand. P is a character pointer, which needs
one byte for storing its value (a character). Hence
sizeof(*p) gives a value of 1. Since it needs two bytes to
store the address of the character pointer sizeof(p) gives 2.

Is This Answer Correct ?    14 Yes 6 No

main() { char *p; printf("%d %d ",sizeof(*p),sizeof(p)); }..

Answer / jha334201553

sizeof(*p) = sizeof(char) = 1
sizeof(p) = sizeof(void *)

I don't know the value of sizeof(p) .In deferent system the
value is deferent.In DOD, it's 2. int 32bits winNT, it's 4.
in 64bits WinNT, It's 8

Is This Answer Correct ?    4 Yes 0 No

main() { char *p; printf("%d %d ",sizeof(*p),sizeof(p)); }..

Answer / nikki

its 1 2

Is This Answer Correct ?    5 Yes 3 No

main() { char *p; printf("%d %d ",sizeof(*p),sizeof(p)); }..

Answer / arif

1,8

Is This Answer Correct ?    2 Yes 0 No

main() { char *p; printf("%d %d ",sizeof(*p),sizeof(p)); }..

Answer / dilberphant

The results are indeterminate. The program code is in error.

1) The variadic function printf() requires an in-scope
prototype. No prototype for printf() has been provided.

2) main() is (by definition) a function that returns an
integer value. It is unclear which version of the C language
this program is intended to conform to, and for most
versions of the language, main() is required to include a
return <value>;
for some integer <value>

3) In a hosted environment, main() accepts either two
arguments (an int, and a char *[]) or none. Thus, either
main(int argc, char *argv[])
or
main(void)
are acceptable

4) The size of a pointer is dependant on operating platform
and C compiler implementation. The C language does not
define a "correct" value for sizeof (char *), and thus /any/
value for sizeof (char *) is acceptable (with the above
caveats about platform and compiler). The value is
unpredictable at a theoretical level.

Is This Answer Correct ?    2 Yes 1 No

main() { char *p; printf("%d %d ",sizeof(*p),sizeof(p)); }..

Answer / rajeev

1,4

Is This Answer Correct ?    4 Yes 3 No

Post New Answer



More C Code Interview Questions

#include<stdio.h> main() { struct xx { int x=3; char name[]="hello"; }; struct xx *s=malloc(sizeof(struct xx)); printf("%d",s->x); printf("%s",s->name); }

1 Answers   TCS,


main() { extern i; printf("%d\n",i); { int i=20; printf("%d\n",i); } }

1 Answers  


func(a,b) int a,b; { return( a= (a==b) ); } main() { int process(),func(); printf("The value of process is %d !\n ",process(func,3,6)); } process(pf,val1,val2) int (*pf) (); int val1,val2; { return((*pf) (val1,val2)); }

1 Answers   Satyam,


How can u say that a given point is in a triangle? 1. with the co-ordinates of the 3 vertices specified. 2. with only the co-ordinates of the top vertex given.

1 Answers  


main() { int a[10]; printf("%d",*a+1-*a+3); }

1 Answers  






main() { char c=' ',x,convert(z); getc(c); if((c>='a') && (c<='z')) x=convert(c); printf("%c",x); } convert(z) { return z-32; }

1 Answers  


To reverse an entire text file into another text file.... get d file names in cmd line

0 Answers   Subex,


void main() { int i=i++,j=j++,k=k++; printf(“%d%d%d”,i,j,k); }

1 Answers  


Write a function to find the depth of a binary tree.

13 Answers   Adobe, Amazon, EFI, Imagination Technologies,


what is brs test reply me email me kashifabbas514@gmail.com

0 Answers  


main() { while (strcmp(“some”,”some\0”)) printf(“Strings are not equal\n”); }

1 Answers  


main() { extern int i; { int i=20; { const volatile unsigned i=30; printf("%d",i); } printf("%d",i); } printf("%d",i); } int i;

1 Answers  






Categories