+ 1

Can I use the getchar(); with int, float, double?

#include<studio.h> Into main() { int a = getint (); } Like this

2nd Aug 2020, 4:36 AM
Rahul Khandekar
Rahul Khandekar - avatar
6 Respuestas
+ 5
The function name explicitly describes the usage, get a character. Did you try, how did it go? because I think it wouldn't work as expected. P.S. Remove any word from thread tags except for 'getchar' please. No codes should be written into tags.
2nd Aug 2020, 4:45 AM
Ipang
+ 4
It's okay I understand, Welcome and please check out this tips for getting good posts and answers 👍 https://www.sololearn.com/Discuss/333866/?ref=app
2nd Aug 2020, 4:51 AM
Ipang
+ 3
No. scanf() with %d and %f for int and float Third lesson in this module: https://www.sololearn.com/learn/C/2914/
2nd Aug 2020, 4:59 AM
Gordon
Gordon - avatar
+ 3
No you can't use getchar() for int , float, double as it takes single character as input.
2nd Aug 2020, 5:58 AM
Shrishti Dogra
Shrishti Dogra - avatar
+ 2
Sorry I'm I new user Thanks to worn me
2nd Aug 2020, 4:48 AM
Rahul Khandekar
Rahul Khandekar - avatar
+ 1
Yes it gave an error But thought that it must have any other function to get the value of int, float, double
2nd Aug 2020, 4:47 AM
Rahul Khandekar
Rahul Khandekar - avatar