+ 1
String index starting from 1. Why *s value put in starting of string why not putting middle of the string?Plz explain how?
char s[]="fine"; *s='n'; cout<<s;
2 Answers
+ 2
*s represent first index means *(s+0) which is n so f will replace to n that's why Output will be
nine
+ 2
... Array/string index definitely does not start from 1 in C++. When used as a pointer, s points to the first character in the C style string, which is 'f'. The resulting value of the operation would be "nine'.