answersLogoWhite

0


Best Answer

return is not necessary if the return type is void, and you want to leave the function only at its end.

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Why is return statement not necessary when function is called by reference?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

In C programming language what are the so called functions statement statement block function block and expressions?

Statements are composed from expressions. A semi-colon turns an expression into a statement. A function is not a statement it is a type definition. A statement block is a compound statement, one or more statements delimited by braces, {}. A function block is the body of a function. The body must be enclosed in braces, {}.


Explain goto and return in c?

A return statement is used to transfer the program control flow to the function that has called the current function under execution. If the function is main, then the program returns the control flow to the operating system. The syntax for return statement is:return return-type;A goto statement is used to transfer the control flow to a particular labelled statement, not necessarily back to the calling program. There are somerestrictionson using a goto statement. For eg: the goto statement should not skip any variable declarations. The use of goto statement is usually considered as a bad programming practice. The syntax for goto statement is:goto label_name;....label_name: statements;


What is a return statement used for?

It means end the function. Functions automatically end when execution reaches the end of the function, but you can return from a function at any point within the function with a return statement. If the function returns a value to its caller, you must provide a reachable return statement along with the value you wish to return.


What is ampersand in C Language?

The ampersand '&' has many uses in the C++ language:The single ampersand can be used to reference the pointer address of a pointer:int* pointer;int* anpointer;anpointer = &pointer;This example, although perhaps not valid, shows that the anpointer reference is now the same as the reference to the pointer memory address.The single ampersand can also be used to reference an object in a function:void function( int param1, int param2, int &reference );If this function were to be called, and the reference object altered within the function, the actualy object that was passed into the function would be altered.The double ampersand '&&' specifies that the left AND the right concepts must both be true before the whole statement is true. For example:if( conceptA true ){conceptC = true;}


How switch function differs from user defined functions in C?

. please give me 3 or 4 differences.one difference is that user defined can be called anytime but not for switch There is no such thing as 'switch function'

Related questions

What is the technique called to keep a cell reference constant when copying a formula or function?

Absolute Reference


Why PHP function is called when page is loaded?

There must be a statement in the file which calls the function


In C programming language what are the so called functions statement statement block function block and expressions?

Statements are composed from expressions. A semi-colon turns an expression into a statement. A function is not a statement it is a type definition. A statement block is a compound statement, one or more statements delimited by braces, {}. A function block is the body of a function. The body must be enclosed in braces, {}.


Do functions get called by reference only?

No. Function parameters are passed by value. Always. Even the so called "call by reference" is a value - the value of the pointer or the address of the object - but what is placed in the parameter list is a value.


Explain goto and return in c?

A return statement is used to transfer the program control flow to the function that has called the current function under execution. If the function is main, then the program returns the control flow to the operating system. The syntax for return statement is:return return-type;A goto statement is used to transfer the control flow to a particular labelled statement, not necessarily back to the calling program. There are somerestrictionson using a goto statement. For eg: the goto statement should not skip any variable declarations. The use of goto statement is usually considered as a bad programming practice. The syntax for goto statement is:goto label_name;....label_name: statements;


What is a return statement used for?

It means end the function. Functions automatically end when execution reaches the end of the function, but you can return from a function at any point within the function with a return statement. If the function returns a value to its caller, you must provide a reachable return statement along with the value you wish to return.


What is the name of a sentence that defines the value of the unknowns in a problem is called a?

A sentence which defines a value of variables in a mathematical problem is called a statement. The relationship between variables in a mathematical problem is called a function.


What is ampersand in C Language?

The ampersand '&' has many uses in the C++ language:The single ampersand can be used to reference the pointer address of a pointer:int* pointer;int* anpointer;anpointer = &pointer;This example, although perhaps not valid, shows that the anpointer reference is now the same as the reference to the pointer memory address.The single ampersand can also be used to reference an object in a function:void function( int param1, int param2, int &reference );If this function were to be called, and the reference object altered within the function, the actualy object that was passed into the function would be altered.The double ampersand '&&' specifies that the left AND the right concepts must both be true before the whole statement is true. For example:if( conceptA true ){conceptC = true;}


How switch function differs from user defined functions in C?

. please give me 3 or 4 differences.one difference is that user defined can be called anytime but not for switch There is no such thing as 'switch function'


What is the difference between passing an array and passing single value data to a function?

Passing a single value to a function is often just a simple integer. But passing an array, character string or other data structure is typically "pass by reference", or in other words, the calling statement will 'point to' the place in memory where the data structure resides.When a function is called using a pointer to a data structure, both the calling environment and the called function are referencing the same data; any changes made to the data in the structure by the function will have changed the data that the original calling environment sees.However, when a value is passed to a function, the function creates it's own copy of the value, and can change it in any way without changing the original value.


How can you change values in call by reference?

We don't call by reference, we call functions. The arguments passed to the function are passed (not called) either by value or by reference, depending upon the function signature (the prototype). When you pass by reference you are passing the actual variable, not a copy of the variable, thus the function can modify that variable's value directly. The only exception is when the parameter is declared a constant reference. Passing a pointer is essentially the same as passing by reference, however the pointer itself is passed by value. To pass a pointer by reference you must pass a pointer-to-pointer instead. Passing by value always copies the value, whether it is declared constant or not. But if it is declared constant, the function might as well accept a constant reference. Passing objects (instances of a class) by constant value will incur a performance penalty in making an unnecessary copy. If it is constant, there is little point in copying the object.


Is it true that passing data by reference enables you to change the value stored in a variable in one file using a function in another file?

Yes, passing a variable by reference gives you a pointer to the original variable, meaning you can change its value from within the function being called and the change will affect the original variable.