TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Maha
NA
0
324.8k
IndexOf(x - y)
Oct 26 2013 10:32 AM
This program is given in the following website. If we use Step Into (F11 key) we can see value of "i" is changed into 3 then it is increased into 4. Again in the
while
brackets 4 is add to 3 and "i" takes new 7. There no add sign in the brackets then how can 4 add to 3 and takes the value 7.
http://www.dotnetperls.com/indexof
using System;
class Program
{
static void Main()
{
// A.
// The input string.
string s = "I have a cat";
// B.
// Loop through all instances of the letter a.
int i = 0;
while ((i = s.IndexOf('a', i)) != -1)
{
// C.
// Print out the substring.
Console.WriteLine(s.Substring(i));
// D.
// Increment the index.
i++;
}
Console.ReadLine();
}
}
/*
ave a cat
a cat
at
*/
Reply
Answers (
2
)
find resolution of image from array of bytes
Using if else condition to compare the result