Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compile Error: Functions cannot return arrays or functions

Status
Not open for further replies.

LuckyStarr

Programmer
Sep 12, 2002
22
BR
Hi All,

I'm a C++ newbie. I'm having a problem compiling the following code:

<code>
typedef char Message[20];

class StaticHelloWorld{
public:
static Message hello;

static void setMessage(Message message){
strcpy(hello,message);
return;
}

static Message getMessage(){
return hello;
}

};

// Definition of the static variable hello
Message StaticHelloWorld::hello = "Ueba";
</code>

The compiler says that functions cannot return arrays or functions at line "return hello;". But it seems for me that it's returning the pointer to the hello array.

So what's the problem? I can't figure it out.

Thanks in advance,

Ricardo.

---
There is no Knowledge that is not power
---
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top