C# Programming - Strings - Discussion

Discussion Forum : Strings - General Questions (Q.No. 9)
9.
Which of the following will be the correct output for the C#.NET code snippet given below?
String s1="Kicit";
Console.Write(s1.IndexOf('c') + " "); 
Console.Write(s1.Length);
3 6
2 5
3 5
2 6
3 7
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
12 comments Page 2 of 2.

Sandeep said:   1 decade ago
If the index start in 0th element then it would be 24 how is 25 I can't understand.

Purusottam said:   1 decade ago
A String has a zero-based index,
So index of c is 2.


Post your comments here:

Your comments will be displayed after verification.