what is the basic use of keyword return?
if we donot use it what is the effect?

Recommended Answers

Sounds like homework.

If you know how to use functions, then you should already be able to answer this question. If you don't know how to use functions, then look at whatever resource you're using to learn. If you don't have a resource to learn from, then we'll point you …

Jump to Post

if we don't use return then there is no value returned to the function?

It's not quite that simple. For extra credit, try to explain what's happening here:

#include <stdio.h>

int foo()
{
}

int main(void)
{
    printf("%d\n", foo());
    return 0;
}
Jump to Post

All 5 Replies

Sounds like homework.

If you know how to use functions, then you should already be able to answer this question. If you don't know how to use functions, then look at whatever resource you're using to learn. If you don't have a resource to learn from, then we'll point you to one.

commented: i got the point thank u +0

i want to know "return" keyword is used to return the value back to the calling function.
if we don't use return then there is no value returned to the function?

if we don't use return then there is no value returned to the function?

It's not quite that simple. For extra credit, try to explain what's happening here:

#include <stdio.h>

int foo()
{
}

int main(void)
{
    printf("%d\n", foo());
    return 0;
}