I have a function that returns an int. How can I call it from the main function.

Recommended Answers

All 2 Replies

#include <stdio.h>

int functionname(int value1,int value2);

int main()
{
    int a;
    
    int parameter1,parameter2;
    
    a = functionname(parameter1,parameter2);//If you want to store the value in a variable which is returned by the function...
    
    functionname(parameter1,parameter2);//If you want to call the function only....
    
    
    
    return 0;
}

int functionname(int value1,int value2)
{
    .....
    .....
    .....
    
    return integer;
    
}

Thanks a milion

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.