You are here:

C++/Sir i want to ask that if...

Advertisement


Question
Sir i want to ask that if we get a string from user and we want to pass each character of this string to a function to perform some process on them then how we will pass it from the main function?what will be the prototype and calling it from main.

Answer
Naveed,
I have a webpage up about functions. The URL is http://www.afweb.net/complang/. This should answer your questions about sending info to a function (in general). To pass along one character of a string, your code would look something like this:

for(int i = 0; i < string.length; i++) {
function_name(string.at(position))
}

I hope this helps.

Best Of Luck,
Alan

C++

All Answers


Answers by Expert:


Ask Experts

Volunteer


Alan F.

Expertise

Having problems with any basic or intermediate parts of C++? I can answer those questions for you using simple English. I have been taking C++ in school for a couple years, so I still remember what it was like to be a beginner (especially with C++, which is a difficult language)!

Experience

I have a C++ web page that discuses the basics of C++. The address is: http://www.afweb.net/complang/

©2016 About.com. All rights reserved.