0
Passing string to a function
2 Answers
+ 3
Do you have a code to share? Maybe someone can help you if we can see where the problem is.
See here:
https://sololearn.com/compiler-playground/Wek0V1MyIR2r/?ref=app
https://sololearn.com/compiler-playground/W0uW3Wks8UBk/?ref=app
+ 2
Karan Shukla , It pretty simple!
just create a function and pass string variable as it parameter.
eg.
#include<iostream>
#include<string>
using namespace std;
void f(string s)
{
cout<<s;
}
int main()
{
f("Code");
return 0;
};
Maybe this can help you.