Jul 03, 2016 Return from void functions in C. We cannot return values but there is something we can surely return from void functions. Some of cases are listed below. A void function can do return We can simply write return statement in a void fun. In-fact it is considered a good practice (for readability of code) to write return; statement to. Alexsandro Meireles wrote: Hi, all! I tried to use the following expression in Dev-C void main (void) The compiler give a warning message 'output of main is not int'. Something like that. Although it gives this warning it compilies well. As far as I know, while the return.type. of a function defaults to int, the return.
- The C Standard Library
- The C++ Standard Library
- The C++ STL Library
- C++ Programming Resources
- Selected Reading
Description
The C++ function std::stack::push() inserts new element at the top of the stack and increases size of stack by one.
Declaration
Following is the declaration for std::stack::push() function form std::stack header.
C++98
C++11
C++ Call Void Function
Parameters
val − Value to be assigned to the newly inserted element.
Return value
None.
Exceptions
Depends upon underlying container.
Time complexity
Constant i.e. O(1)
Example
C++ Void Function Return
The following example shows the usage of std::stack::push() function.
Dev C++ Void Functions
Let us compile and run the above program, this will produce the following result −