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 ?    15 Yes 7 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 ?    6 Yes 0 No

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

Answer / arif

1,8

Is This Answer Correct ?    5 Yes 1 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

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

Answer / nikki

its 1 2

Is This Answer Correct ?    5 Yes 5 No

Post New Answer

More C Code Interview Questions

Cau u say the output....?

1 Answers  


write a program in c language to get the value of arroy keys pressed and display the message which arrow key is pressed?

1 Answers  


#include"math.h" void main() { printf("Hi everybody"); } if <stdio.h> will be included then this program will must compile, but as we know that when we include a header file in "" then any system defined function find its defination from all the directrives. So is this code of segment will compile? If no then why?

2 Answers  


main() { int i=-1,j=-1,k=0,l=2,m; m=i++&&j++&&k++||l++; printf("%d %d %d %d %d",i,j,k,l,m); }

1 Answers  


Write a complete program that consists of a function that can receive two numbers from a user (M and N) as a parameter. Then print all the numbers between the two numbers including the number itself. If the value of M is smaller than N, print the numbers in ascending flow. If the value of M is bigger than N, print the numbers in descending flow. may i know how the coding look like?

2 Answers  






main() { int x=5; clrscr(); for(;x<= 0;x--) { printf("x=%d ", x--); } } a. 5, 3, 1 b. 5, 2, 1, c. 5, 3, 1, -1, 3 d. –3, -1, 1, 3, 5

2 Answers   HCL,


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

0 Answers  


how to concatenate the two strings

1 Answers  


char inputString[100] = {0}; To get string input from the keyboard which one of the following is better? 1) gets(inputString) 2) fgets(inputString, sizeof(inputString), fp)

1 Answers  


write a c program to Create a registration form application by taking the details like username, address, phone number, email along with password and confirm password (should be same as password).Ensure that the password is of 8 characters with only numbers and alphabets. Take such details for 5 users and display the details. In place of password display “****”. (Use Structures).

0 Answers   CDAC, College School Exams Tests,


#include<conio.h> main() { int x,y=2,z,a; if(x=y%2) z=2; a=2; printf("%d %d ",z,x); }

1 Answers  


int a = 10 + 10 .... ,... A = A * A What would be the value of A? The answer is 120!! Could anyone explain this to me.

2 Answers   Bosch, eInfochips, HCL, IHCL,


Categories