- how is string stored ?
- when i subtract str[i+1]-str[i] how does it automatically subtract ascii value and give me result ?
3.my code is giving me garbage value at the end please help me find the mistake . CODE ID:- 257747
Problem in concept of string
hello @chitranshanmol07
-

execute this line only when i+1 < n , this is done to avoid garbage value that u r getting -
chars are like number only subtracting char is similar to subtracting numers.
compiler knows ascii value so it uses those value to perform operation -
string is like array of characters and in array all elements are stored in contigous fashion in memory.
same is the case with string ,here all its characters all stored in contigous memory location
