main()
{
char *p;
printf("%d %d ",sizeof(*p),sizeof(p));
}
Answers were Sorted based on User's Feedback
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 ? | 16 Yes | 7 No |
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 |
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 |
There are 21 people in a room. They have to form groups of 3 people each. How many combinations are possible? Write a C program to print the same.
main() { int i=10,j=20; j = i, j?(i,j)?i:j:j; printf("%d %d",i,j); }
write a c program to Reverse a given string using string function and also without string function
void main() { int *i = 0x400; // i points to the address 400 *i = 0; // set the value of memory location pointed by i; }
Derive expression for converting RGB color parameters to HSV values
Which version do you prefer of the following two, 1) printf(ā%sā,str); // or the more curt one 2) printf(str);
create a login program that ask username and password. if you input username or password 3 times wrong, the program will terminate else the program will prompt a message "congratulations"
Program to find the largest sum of contiguous integers in the array. O(n)
main() { char p[ ]="%d\n"; p[1] = 'c'; printf(p,65); }
Finding a number which was log of base 2
main() { int i=0; for(;i++;printf("%d",i)) ; printf("%d",i); }
main() { int y; scanf("%d",&y); // input given is 2000 if( (y%4==0 && y%100 != 0) || y%100 == 0 ) printf("%d is a leap year"); else printf("%d is not a leap year"); }