+ 2

Use of undeclared identifer "sgshs" why????

#include <iostream> #include <string> using namespace std; void print (string word) { cout << word << endl; } int main() { print (sgshs); return 0; }

15th Aug 2018, 2:38 PM
ПризракTM
ПризракTM - avatar
5 Answers
+ 2
because sgshs is a variable, if you want to display sgshs you need to do print("sgshs"); notice the quotes, they make it a string without them you are trying to pass an undeclared variable to print
15th Aug 2018, 2:43 PM
StealthyTaco
StealthyTaco - avatar
+ 3
You gave to enter it as "sgshs", not sgshs as there is no any varible declared in that name
15th Aug 2018, 2:46 PM
Seniru
Seniru - avatar
+ 3
welcome my friend, you can ask any question here and there.will be the friendly SL community to help you☺☺
15th Aug 2018, 2:49 PM
Seniru
Seniru - avatar
+ 2
oh, thanks!
15th Aug 2018, 2:48 PM
ПризракTM
ПризракTM - avatar
+ 2
really thanks) you all helped me a lot)
15th Aug 2018, 2:57 PM
ПризракTM
ПризракTM - avatar