answersLogoWhite

0


Best Answer

no

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Is return type can also be used in a function with return type void?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Why void is used in c language?

void as function return-type means no return value void as function parameter means no parameter void * as pointer type means generic pointer


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 return in programming?

The return statement is used in functions to return control to the caller. If the function is declared non-void, the return statement also allows the programmer to return a value to the caller.


What are the different types of function in c plus plus programming?

There are five types of functions and they are:Functions with no arguments and no return values.Functions with arguments and no return values.Functions with arguments and return values.Functions that return multiple values.Functions with no arguments and return values.Functions with no arguments and no return value.A C function without any arguments means you cannot pass data (values like int, char etc) to the called function. Similarly, function with no return type does not pass back data to the calling function. It is one of the simplest types of function in C. This type of function which does not return any value cannot be used in an expression it can be used only as independent statement.Functions with arguments and no return value.A C function with arguments can perform much better than previous function type. This type of function can accept data from calling function. In other words, you send data to the called function from calling function but you cannot send result data back to the calling function. Rather, it displays the result on the terminal. But we can control the output of function by providing various values as arguments. Functions with arguments and return value.This type of function can send arguments (data) from the calling function to the called function and wait for the result to be returned back from the called function back to the calling function. And this type of function is mostly used in programming world because it can do two way communications; it can accept data as arguments as well as can send back data as return value. The data returned by the function can be used later in our program for further calculations. Functions with no arguments but returns value.We may need a function which does not take any argument but only returns values to the calling function then this type of function is useful. The best example of this type of function is "getchar()" library function which is declared in the header file "stdio.h". We can declare a similar library function of own. Functions that return multiple values.So far, we have learned and seen that in a function, return statement was able to return only single value. That is because; a return statement can return only one value. But if we want to send back more than one value then how we could do this? We have used arguments to send values to the called function, in the same way we can also use arguments to send back information to the calling function. The arguments that are used to send back data are called Output Parameters.It is a bit difficult for novice because this type of function uses pointer


Explain the structure of c program with an suitable example?

Basic structure of a C program is /* Documentation section */ /* Link section */ /* Definition section */ /* Global declaretion section */ /* Function section */ (return type) (function name) (arguments...) void main() { Declaration part Executable part (statements) } /* Sub-program section */ (return type) (function name 1) (arguments...) (return type) (function name 2) (arguments...) . . . (return type) (function name n) (arguments...) Basic structure of a C program is /* Documentation section */ /* Link section */ /* Definition section */ /* Global declaretion section */ /* Function section */ (return type) (function name) (arguments...) void main() { Declaration part Executable part (statements) } /* Sub-program section */ (return type) (function name 1) (arguments...) (return type) (function name 2) (arguments...) . . . (return type) (function name n) (arguments...)

Related questions

Why void is used in c language?

void as function return-type means no return value void as function parameter means no parameter void * as pointer type means generic pointer


Why function should return a value?

Not all functions return values. If you take a function which is of type void, you get a function which is does not return anything. The only functions which should return values are those which are used as a right side of expressions (so called rvalues).


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 return in programming?

The return statement is used in functions to return control to the caller. If the function is declared non-void, the return statement also allows the programmer to return a value to the caller.


What are the different types of function in c plus plus programming?

There are five types of functions and they are:Functions with no arguments and no return values.Functions with arguments and no return values.Functions with arguments and return values.Functions that return multiple values.Functions with no arguments and return values.Functions with no arguments and no return value.A C function without any arguments means you cannot pass data (values like int, char etc) to the called function. Similarly, function with no return type does not pass back data to the calling function. It is one of the simplest types of function in C. This type of function which does not return any value cannot be used in an expression it can be used only as independent statement.Functions with arguments and no return value.A C function with arguments can perform much better than previous function type. This type of function can accept data from calling function. In other words, you send data to the called function from calling function but you cannot send result data back to the calling function. Rather, it displays the result on the terminal. But we can control the output of function by providing various values as arguments. Functions with arguments and return value.This type of function can send arguments (data) from the calling function to the called function and wait for the result to be returned back from the called function back to the calling function. And this type of function is mostly used in programming world because it can do two way communications; it can accept data as arguments as well as can send back data as return value. The data returned by the function can be used later in our program for further calculations. Functions with no arguments but returns value.We may need a function which does not take any argument but only returns values to the calling function then this type of function is useful. The best example of this type of function is "getchar()" library function which is declared in the header file "stdio.h". We can declare a similar library function of own. Functions that return multiple values.So far, we have learned and seen that in a function, return statement was able to return only single value. That is because; a return statement can return only one value. But if we want to send back more than one value then how we could do this? We have used arguments to send values to the called function, in the same way we can also use arguments to send back information to the calling function. The arguments that are used to send back data are called Output Parameters.It is a bit difficult for novice because this type of function uses pointer


What is a function prototype and how are they used?

A function prototype is the first line of a function which depicts its access specifier, modifier ,return type and name along with the number and type of arguments in it.. example: public static void zoom(int a,String b)


What is the function that eliminates the need to place the function definition before all calls to the function?

A forward declaration. In all statically typed languages (such as C++), all types must be declared before they can be used. A function is a type (the return value defines its type), but the compiler only needs to know how the function is called, not how it is implemented, so the function definition does not need to be visible to the compiler before the function can be called. The definition can actually be placed in another translation unit entirely. Note that a function definition is also a function declaration. Forward declarations make it possible for two functions to be dependent upon each other. A function declaration includes the return type, the name of the function and its argument types. The formal names of a function's arguments are not required in it's declaration, they are only required in its definition. A function's signature is the same as its declaration but excludes the return type. All calls to a function must match its signature. If the return type is used, it must be assigned to a type that is covariant with the declared type. Function declarations are typically placed in header files. By including the header in every translation unit that uses the function, we ensure the function's declaration is consistent across all translation units. If the function is defined in the same header it is declared, then it must also be declared inline. Multiple definitions of the same function are permitted provided they are token-for-token identical, thereby adhering to the one definition rule (ODR).


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.


Explain the structure of c program with an suitable example?

Basic structure of a C program is /* Documentation section */ /* Link section */ /* Definition section */ /* Global declaretion section */ /* Function section */ (return type) (function name) (arguments...) void main() { Declaration part Executable part (statements) } /* Sub-program section */ (return type) (function name 1) (arguments...) (return type) (function name 2) (arguments...) . . . (return type) (function name n) (arguments...) Basic structure of a C program is /* Documentation section */ /* Link section */ /* Definition section */ /* Global declaretion section */ /* Function section */ (return type) (function name) (arguments...) void main() { Declaration part Executable part (statements) } /* Sub-program section */ (return type) (function name 1) (arguments...) (return type) (function name 2) (arguments...) . . . (return type) (function name n) (arguments...)


What value would Excel include in a calculation?

Any type of value can be used in a calculation, mainly numbers, but also things like dates, text and logical values. If used in a function, the values are known as arguments.Any type of value can be used in a calculation, mainly numbers, but also things like dates, text and logical values. If used in a function, the values are known as arguments.Any type of value can be used in a calculation, mainly numbers, but also things like dates, text and logical values. If used in a function, the values are known as arguments.Any type of value can be used in a calculation, mainly numbers, but also things like dates, text and logical values. If used in a function, the values are known as arguments.Any type of value can be used in a calculation, mainly numbers, but also things like dates, text and logical values. If used in a function, the values are known as arguments.Any type of value can be used in a calculation, mainly numbers, but also things like dates, text and logical values. If used in a function, the values are known as arguments.Any type of value can be used in a calculation, mainly numbers, but also things like dates, text and logical values. If used in a function, the values are known as arguments.Any type of value can be used in a calculation, mainly numbers, but also things like dates, text and logical values. If used in a function, the values are known as arguments.Any type of value can be used in a calculation, mainly numbers, but also things like dates, text and logical values. If used in a function, the values are known as arguments.Any type of value can be used in a calculation, mainly numbers, but also things like dates, text and logical values. If used in a function, the values are known as arguments.Any type of value can be used in a calculation, mainly numbers, but also things like dates, text and logical values. If used in a function, the values are known as arguments.


What is the difference between using a return value and a pass-by-reference parameter?

The main difference is that return values can be used in compound statements (such as assignments), whereas output parameters cannot. An output parameter is a non-const parameter that is passed by reference or as a pointer variable.As a general rule, every function should return something through the return value, even if only an error level where zero would typically indicate success (but not always). A function that does not return anything (returns void) is not strictly a function, it is better described as a procedure. However, if a function can be guaranteed never to fail (provides trivial functionality) and has no need to return any other value to the caller, then returning void is a logical option. Just because a function should return a value doesn't mean that it must return a value.However, the return value is limited by the fact that it only permits one value to be returned by a function. Output parameters allow a function to return several values at once and can be used in conjunction with the return value. If there is no need for the return value, it should be used to indicate the error level of the function wherever it would be appropriate. However it is not unusual for a function to accept a reference as an output parameter and to also return that same reference via the return value.Note that although you could return multiple values via a struct or class type, this should only be considered if you have several functions that can make use of the struct or class type. However, in most cases it would be simpler to make those functions members of the struct or class itself.


What is mean void in c plus plus?

Void means there is no data type. So if you have a void function it does not return a value (and attempting to do so will cause an error) whereas a non-void function (ex. int, long, String, bool, etc) will return a value of that type.