Hi folks.
I'm just learning C language,and I always come across a statement that I have no idea what it means. What does "returning a variable" mean?
Thanks.

When a function is finished, the final statement in the funct can be something like return x; x is the value returned into the variable.

Example:

val = add(a, b);    // add A and B
...

int add (int x, int y)  // define the add function
{
    int z;

    z = x + y;     // add the values
    return z;      // return the value of the addition
}

val will contain the sum when the function is finished.

When you get to functions you will understand -- I hope ;)

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.