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 |
main() { 41printf("%p",main); }8
1. const char *a; 2. char* const a; 3. char const *a; -Differentiate the above declarations.
main() { printf("\nab"); printf("\bsi"); printf("\rha"); }
Printf can be implemented by using __________ list.
#include<stdio.h> #include<conio.h> void main() { int a=(1,2,3,(1,2,3,4); switch(a) { printf("ans:"); case 1: printf("1");break; case 2: printf("2");break; case 3: printf("1");break; case 4: printf("4");break; printf("end"); } getch(); }
write a program in c to merge two array
How we will connect multiple client ? (without using fork,thread)
Ramesh’s basic salary is input through the keyboard. His dearness allowance is 40% of basic salary, and house rent allowance is 20% of basic salary. Write a program to calculate his gross salary.
main() { { unsigned int bit=256; printf("%d", bit); } { unsigned int bit=512; printf("%d", bit); } } a. 256, 256 b. 512, 512 c. 256, 512 d. Compile error
Write a C function to search a number in the given list of numbers. donot use printf and scanf
#include<stdio.h> main() { register i=5; char j[]= "hello"; printf("%s %d",j,i); }
main() { int *j; { int i=10; j=&i; } printf("%d",*j); }