Is it possible for a function to return a string,an array of characters to the calling function?
i mean something like
char f1()
{
char www="nima";
return(www);
}
if not,please tell me how is this possible?
abcd_nima
0
Newbie Poster
Recommended Answers
Jump to PostThere are a several ways to return a string to a calling function. You can use char* or the C++ string class.
I would recommend:
int foo(char* myString){ strcpy(myString,"www"); return 0; }
int foo(string& myString){ myString = "www"; return 0; }
You can …
All 3 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.