Hi Can anyone please help me understand and so possibly illustrate with an example why and how a function cant return or evaluate more than one value ?

Recommended Answers

All 3 Replies

int something(int a,int b, int c)
{
     int d;
     \\does something
     return d;
}

How is this function called????

int z;
z=something(a,b,c);

So how can you assign two returned value to one variable???
Makes sense???
So a function cannot return two values.....

int something(int a,int b, int c)
{
     int d;
     \\does something
     return d;
}

How is this function called????

int z;
z=something(a,b,c);

So how can you assign two returned value to one variable???
Makes sense???
So a function cannot return two values.....

A function can return a value :/
Note the term "void" in a function means it doesnt return a variable but everything else does e.g. bool functionhere() can return a value either true or false

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.