+ 2
How the program know the end of input string?
2 Answers
+ 1
A string is merely an array of characters. If you get further into the details of this kind of thing you'll find out about null bytes. These are pretty much null positions in an array for the processor to read as periods.
For example, if I create a string:
"Sololearn". This is equal to an array ["s", "o", "l", ... and so on. If you look at this in assembly, you'll notice a null byte added into the character array. This is at the end of the array so the processor knows to set eip to the next command which is usually a type of jump (jmp). It's a very technical question so I had to give a slightly technical answer. I suggest looking into assembly programming to learn more.
+ 1
there is something called null pointer in c - \0. It signifies the end of a string. There is another type of string terminator EOF which has the value of -1. When the compiler reaches -1 or null terminator it knows it's the end of the string.