0

Passing string to a function

6th Dec 2024, 7:12 AM
Karan Shukla
Karan Shukla - avatar
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
6th Dec 2024, 7:29 AM
Ausgrindtube
Ausgrindtube - avatar
+ 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.
6th Dec 2024, 5:08 PM
Alhaaz
Alhaaz - avatar