C
Programming and Technical
Programming
Program
What is the output of this C code?
#include
int main()
{
int i = 10;
void *p = &i;
printf("%dn", (int)*p);
return 0;
}
a) Compile time error
b) Segmentation fault/runtime crash
c) 10
d) Undefined behaviour
Read Solution (Total 9)
-
- a)compile time error
- 11 years agoHelpfull: Yes(6) No(0)
- this is wrong because the syntax of void pointer is *((int *)p);
- 10 years agoHelpfull: Yes(5) No(0)
- 10
its a void pointer
- 10 years agoHelpfull: Yes(2) No(4)
- 10 since the pointer is pointing to the address where i is present,it includes value of 10 and we concerted the pointer form to int
- 10 years agoHelpfull: Yes(1) No(0)
- (a)compile time error
- 10 years agoHelpfull: Yes(0) No(0)
- a) Compile time error
- 10 years agoHelpfull: Yes(0) No(0)
- compile time error
- 10 years agoHelpfull: Yes(0) No(0)
- Ans option is c
- 10 years agoHelpfull: Yes(0) No(0)
- compile time error...Becoz the syntax of void expression is invalid
- 6 years agoHelpfull: Yes(0) No(0)
C Other Question