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 ? | 15 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 |
What is the output for the following program main() { int arr2D[3][3]; printf("%d\n", ((arr2D==* arr2D)&&(* arr2D == arr2D[0])) ); }
main() { int i=-1; +i; printf("i = %d, +i = %d \n",i,+i); }
main() { 41printf("%p",main); }8
write a program to Insert in a sorted list
#include <stdio.h> #define a 10 main() { #define a 50 printf("%d",a); }
¦void main() ¦{ ¦int i=10,j; ¦ j=i+++i+++i; ¦printf("%d",j); ¦getch(); ¦} ¦ output:-30 but in same question if we write as- ¦void main() ¦{ ¦int i=10; ¦ int j=i+++i+++i; ¦printf("%d",j); ¦getch(); ¦} ¦ output:-33 why output is changed from 30 to 33. Can any body answer...
write a program for area of circumference of shapes
Display the time of the system and display the right time of the other country
void ( * abc( int, void ( *def) () ) ) ();
Cluster head selection in Wireless Sensor Network using C programming language.
void main() { int x,y=2,z; z=(z*=2)+(x=y=z); printf("%d",z); }
int aaa() {printf(“Hi”);} int bbb(){printf(“hello”);} iny ccc(){printf(“bye”);} main() { int ( * ptr[3]) (); ptr[0] = aaa; ptr[1] = bbb; ptr[2] =ccc; ptr[2](); }