Hello, I'm studying functions right now and need clarification. I did a 'search' but the examples and explanations I read were still a bit cryptic to me.
How would I pass a function call that had a string in it? For example, here is a function call that holds an int and a string.
1 2
/*call from main*/
void learnPass(number, "John Doe");
Questions:
1. There must be int number definition in main, correct?
2. To pass by value, what would the prototype and function definition header look like?
3. To pass by reference, what would the prototype and function definition header look like?
@Trac511
For example, here is a function call that holds an int and a string.
1 2
/*call from main*/
void learnPass(number, "John Doe");
void learnPass(number, "John Doe");
This is not a function call. It is an invalid syntactic construction. I think the internet (including this forum) has very many examples of function declarations and function calls. Try to find answers on such simple questions yourself.
#include <iostream>
#include <sstream>
#include <string>
usingnamespace std;
int n = 1;
int main(){
stringstream A;
string B;
A << n;
A >> B;
string C = C + "John Doe";
cout << C << endl;
system ("PAUSE");
}