Functions That Return value : Function Return « Function « C Tutorial






#include <stdio.h>
#include <stdlib.h>

int getval(void);

int main()
{
    int weight;


    weight=getval();
    return(0);
}

int getval(void)
{
    char input[20];
    int x;
    printf("some integer:");
    gets(input);
    x=atoi(input);
    return(x);
}
some integer:123








8.7.Function Return
8.7.1.If the function does not return any value
8.7.2.Return value as pointer
8.7.3.Functions That Return value