What is the output of the following code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What is the output of the following code?

#include<stdio.h> int main() { void n=5; printf("%v",n); return 0; }

29th May 2019, 12:48 PM
Srija Padmanabhuni
2 Answers
+ 7
Srija Padmanabhuni hi, An object of void type cannot be declared. But void pointers can be defined. If you want to use void then use it directly as void doesn't contain any value #include <stdio.h> int main() { printf ("%v",5); return 0; } void pointers example int a = 5; char b = 'x'; void *p = &a;  // void pointer holds address of int 'a' p = &b; if you have any query then ping me have this 🍎 🍎 🍎 🍎 🍎
29th May 2019, 12:59 PM
DishaAhuja
DishaAhuja - avatar
+ 2
Thank you 😊 DishaAhuja
29th May 2019, 1:14 PM
Srija Padmanabhuni