ExamVeda
Login
Home
This question belongs to C Program Pointer
Pointer
?

What will be the output of the following program?
#include<stdio.h>
void main()
{
      int i = 10;
      void *p = &i;
      printf("%d\n", (int)*p);
}

Answer & Solution
Correct Answer: Option A

p is pointer of type void.

Examveda
Question posted by Examveda
Community

Join the Discussion

5 Comments
RAJA SEKHAR
RAJA SEKHAR 4 years ago
*(int*)p it should be like this
Viren Adwani
Viren Adwani 6 years ago
if we typecat it into int pointer we can like
*(int*)p;//in printf
Kaizer Chief
Kaizer Chief 8 years ago
answer will be 10 if it is int *p =&i instead of void *p =&i.
Akshay A.K
Akshay A.K 8 years ago
Answer is 10,why should error here
Muthu Kutty
Muthu Kutty 10 years ago
y should return an error.here,we did type casting,so it will be rerurn regarding output.If we don't type casting means