Here when I declared “char” ,
takes input from console(and I give “string” , hit enter)
it gives only 1st charachter of string,
not entire string.
Where as in this video it’s giving entire string,why is it so?
Getting different o/p as described in the video
Input that is written on terminal is a string but we have defined in our code ch as a char which takes only one character at a time from the input string. Input string on pressing enter is stored in an input buffer and from there one by one character is taking as input and stored in ch till we encounter ‘.’ .
1 Like