0

What is the output of the code? string s=sololearn. Console.WriteLine("s[6]");

30th Nov 2016, 5:37 AM
Kowsalya A
Kowsalya A - avatar
4 Answers
+ 3
Probably an error. 'sololearn' is not between quotes, so it's interpreted as a variable. If it's not defined, you'll get an error. If you meant 'string s="sololearn";', then @Azizbek is right: strings are indexed beginning with 0, so 's[6]' is actually the 7th character.
30th Nov 2016, 6:20 AM
Álvaro
+ 2
a?
30th Nov 2016, 5:50 AM
Azizbek Kobilov
Azizbek Kobilov - avatar
+ 1
Ans will be a
24th Apr 2021, 7:04 AM
Md. Rakibul Islam
Md. Rakibul Islam - avatar
0
s="sololearn"; s[6]=a// 7th element
30th Nov 2016, 2:09 PM
Akwin Lopez
Akwin Lopez - avatar