+ 1

Why is %c and %s in getchar & gets

6th Jan 2021, 2:49 PM
Sufal Kadariya
Sufal Kadariya - avatar
2 Respostas
+ 1
Sufal Kadariya Read the lesson and associated comments patiently: https://www.sololearn.com/learn/C/2914/?ref=app
6th Jan 2021, 3:03 PM
Alphin K Sajan
Alphin K Sajan - avatar
+ 1
%c and %s aren't in getchar and gets because we don't pass an actual argument to getchar, instead getchar returns ascii value of the entered value to the char variable. In gets the base address (the address of the zeroth element in the string) is passed to function gets then gets receives the user input and writes it to the string you passed the base address of . If you don't understand me then go through the topics of strings, functions, arrays and pointers.
6th Jan 2021, 3:26 PM
Muzammil
Muzammil - avatar