+ 1

Why'd we can't make string as the return type's of a function in the header file?

Confused with the header

26th Mar 2018, 6:51 AM
Riannanda Faza
Riannanda Faza - avatar
3 Answers
+ 4
You can. Its valid for both C-strings and C++ strings : C : char* strcat(char*,const char*); C++ : string strcat(string, const string);
26th Mar 2018, 8:22 AM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar
+ 2
I assume you're using C++ because you say header file. it's been a long time since I did any C code but I do remember that string type is not a standard data type. you mightneed to include something, maybe string.h to use it. I'm not sure this is correct but it's my best guess.
26th Mar 2018, 8:19 AM
Nathan Stanley
Nathan Stanley - avatar
+ 1
In C++ you can but make sure the string. H header file is included.
4th Apr 2018, 9:16 AM
shashuri Magrease
shashuri Magrease - avatar