+ 2
Why can't I use char type with scanf() and do the void pointer in C language?
I was learning Void pointers and tried to make the code with scanf(), but the code wouldn't print the char. Please help https://code.sololearn.com/c3927x2fvs8G/?ref=app
10 Respuestas
+ 4
Manthan Gohel
Try adding a space in between each format specifier in the `scanf` call. e.g.
scanf("%d %f %c", &x, &y, &c);
+ 4
Share your code within your question Description please, people need to see your code to really understand the situation. So share that code, in case you don't know how, see the following guide on how to share links 👍
https://www.sololearn.com/post/74857/?ref=app
+ 4
~ swim ~ Thanks
+ 4
Got it ~ swim ~
Big Thanks 🙏😂
+ 3
Ipang Ok
+ 2
Ipang Now take a look.
+ 2
Ipang Now it's working, Thank you.
But I tried with 2 scanf() one for int and float and second for char, but it didn't worked then.
0
~ swim ~
I was wondering, is casting necessary when assigning an address of variable into a void pointer?
In the code ...
void *ptr;
...
ptr = &x;
My doubt is ... is it necessary to cast the address as void pointer?
ptr = (void*)&x;
0
Hi
0