Reading character and converting to integer

c
code
memory
time

#1

In many solutions I see people reading in character in place of integer and then converting the character to integer.
What effect does it have on time and memory. What is the main idea behind doing this?
Can someone explain this with a good example.
Thank You!


#2

basically it is done to reduce the time of execution…see these two codes for the problem INTEST!!!

CODE1 using scanf, time:- 5.54 secs.

CODE2 using char by char input and output, time:- 0.82 secs

for understanding this method u can refer to this post…LINK…on this link getc() is used…a faster method is to use getchar_unlocked() in place of getc()…hope this helps…:slight_smile: