answersLogoWhite

0

You can do this by creating a forwarddeclaration of the function. You can call the forward drclared function inside the main to use it.


int result(float num1, float num2);


int

main(void)

{

int value = result(3.14, 2.74);

return (0);

}


int

result(float num1, float num2)

{

int value = 0;

// function codes goes here

// you can alter the value of variable 'value'

return (value);

}


The returning value of the 'result()' function is assigned to variable 'value' in 'main()'.

User Avatar

Wiki User

9y ago

What else can I help you with?

Continue Learning about Engineering

What module returns a value back to the part of the program that called it?

A function. You can have a function that returns but doesn't return a value with it.


What is base of any C program?

The base of any C program is the main function, which serves as the entry point for execution. Every C program must include this function, which is defined with the signature int main() or int main(int argc, char *argv[]). Within main, the program's logic is implemented, and it typically returns an integer value indicating the success or failure of the program. Additionally, the program may include preprocessor directives, variable declarations, and function definitions that support its functionality.


What function must be in all c plus plus programs?

Every C++ program must have a main() function that returns an integer:int main(){// user-code goes here....// Main must return an integer to the calling program.// A non-zero value usually indicates an error occurred but// the exact meaning of the return value is user-defined.return( 0 );}


WHICH FUNCTION WILL RETURN A RESULT WITHOUT YOU SUPPLYING AN ARGUMENT TO IT IN ACCESS?

In Microsoft Access, the function that will return a result without requiring an argument is the Now() function. This function retrieves the current date and time from the system without needing any input. Another example is the Date() function, which returns the current date. Both functions can be used in queries, expressions, and VBA code.


What is a variable that is used within a function?

If the variable is declared within the function body, it is a local variable, one that is local to the function. Local variables fall from scope when the function returns, they are only accessible within the function. However, local variables can be returned by value, which creates an automatic variable that is returned to the caller. If the caller does not store the return value, the automatic variable falls from scope when the expression containing the function call ends. However, the expression may evaluate the return value without storing it. Note that functions cannot return local variables by reference since the local variable falls from scope when the function returns. If the variable is passed as an argument to the function, then the variable is a parameter of the function. Arguments may be passed by value or by reference, depending upon the function signature. Passing by value means the function parameter is a copy of the argument (if the argument is an object, the object's copy constructor is invoked automatically). Thus any changes made to the parameter within the function are not reflected in the argument that was originally passed, and the parameter will fall from scope when the function returns. However, the value of the parameter can be returned as previously explained. Passing by reference means the function parameter refers directly to the argument that was passed. Thus any changes made to the parameter are reflected in the argument. Parameters that are declared as constant references assure the caller that the reference's immutable members will not be altered by the function. If the parameter is a non-const reference but the caller does not wish changes to be reflected in the argument, the caller should pass a copy of the argument instead.

Related Questions

A function prime that returns if its argument is a prime no or returns zero?

prime number


Can you write a program without specifying the prototype of any function?

You can write a program without specifying its prototype when the function returns an integer.If the prototype is not mentioned the compiler thinks that the return type of the function used is integer.When making program which return integer you can ignore writing the protoype.


What module returns a value back to the part of the program that called it?

A function. You can have a function that returns but doesn't return a value with it.


What is base of any C program?

The base of any C program is the main function, which serves as the entry point for execution. Every C program must include this function, which is defined with the signature int main() or int main(int argc, char *argv[]). Within main, the program's logic is implemented, and it typically returns an integer value indicating the success or failure of the program. Additionally, the program may include preprocessor directives, variable declarations, and function definitions that support its functionality.


What date manipulation functions returns a numeric value in SQL?

In SQL, the DATEDIFF() function returns a numeric value representing the difference between two dates in terms of days. Similarly, the DATEPART() function can return a numeric value for specific parts of a date, such as year, month, or day. Additionally, the DATEDIFF_BIG() function operates like DATEDIFF() but returns a larger integer for differences that exceed the range of a standard integer.


What are the conditional logic functions in computer applications?

Not sure what you are asking here, but here is my best guess.COMPUTER PROGRAMMING APPLICATIONS:IF - If a condition exists, do something, if not, do something else.CASE - If a condition equals CASE1 do this; if CASE2 do this; etc.WHILE - If a condition remains, keep doing something until the condition changes.EXCEL:AND(logical1,logical2,...) - tests whether the logical arguments are TRUE or FALSE. If they are all TRUE, the AND function returns TRUE to the cell. If any are FALSE, the AND function returns FALSE.IF(logical_test,value_if_true,value_if_false) - tests whether the logical_test expression is TRUE or FALSE. If TRUE, the IF function returns the value_if_true argument. If FALSE, the IF function returns the value_if_false argument.IFERROR(value,value_if_error) - tests whether the value expression is an error. IFERROR returns value_if_error if the expression is an error, or value of the expression if it is not an error.NOT(logical) - tests whether the logical argument is TRUE or FALSE. If TRUE, the NOT function returns FALSE. If FALSE, the NOT function returns TRUE.OR(logical1,logical2,...) - tests whether the logical arguments are TRUE or FALSE. If any are TRUE, the OR function returns TRUE. If all are FALSE, the OR function returns FALSE.FALSE() - takes no argument and simply enters logical FALSE in its cell.TRUE() - takes no argument and simply enters logical TRUE in its cell.


What is a named operation that returns a value in the Excel program used to simplify formulas?

A function.


What function must be in all c plus plus programs?

Every C++ program must have a main() function that returns an integer:int main(){// user-code goes here....// Main must return an integer to the calling program.// A non-zero value usually indicates an error occurred but// the exact meaning of the return value is user-defined.return( 0 );}


Write a function prime that return 1 if its argument is a prime and returns 0 otherwise?

#include<stdio.h> #include<conio.h>main() { }


Write a function prototype named test that accepts two parameters an integer and character and returns a float?

float test(int, char);


The greatest integer function shown below is defined so that it produces the greatest integer or equal to x.?

The greatest integer function, often denoted as (\lfloor x \rfloor), returns the largest integer that is less than or equal to the given value (x). For example, (\lfloor 3.7 \rfloor) equals 3, while (\lfloor -2.3 \rfloor) equals -3. This function effectively "rounds down" any non-integer value to the nearest whole number.


WHICH FUNCTION WILL RETURN A RESULT WITHOUT YOU SUPPLYING AN ARGUMENT TO IT IN ACCESS?

In Microsoft Access, the function that will return a result without requiring an argument is the Now() function. This function retrieves the current date and time from the system without needing any input. Another example is the Date() function, which returns the current date. Both functions can be used in queries, expressions, and VBA code.