KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have this code below and I'm getting the error upon compilation: error: cannot convert 'const char*' to 'std::string*' for argument '1' to 'void sillyFunction(std::string*, int)' #include <iostream> #include <string> using namespace std; int counter = 0; void sillyFunction(string * str, int cool=0); int main(){ sillyFunction("Cool"); sillyFunction("Cooler", 1); return 0; } void sillyFunction(string * str, int cool){ counter++; if (cool){ for (int i=0; i<counter; i++) cout << *str << endl; } else { cout << *str << endl; } }
Tags (comma-separated)
Save Edits
Cancel