answersLogoWhite

0

What is mean void in c plus plus?

Updated: 8/10/2023
User Avatar

Wiki User

15y ago

Best Answer

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.

User Avatar

Wiki User

15y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

14y ago

Strictly speaking a void routine is not a function, since a function must return a value. Therefore, a void routine is a subroutine that does not return a value as its name, and can be called standalone.

For example, a void routine to add two numbers together and place the value in a third could be called as:

void Sum (int one, int two, int * three) ;

and could be called as:

Sum (firstVal, secondVal, &thirdVal) ;

This answer is:
User Avatar

User Avatar

Wiki User

10y ago

Void has two purposes: when used as the formal return value of a function, it simply means that the function returns no value, not even zero. But when used to specify a void pointer type (void*), it simply means that the pointer is of unknown type. It is up to the caller to decide the actual type. However C++ is more strict than C with regards to type-safety, thus the return value of the C-style malloc function must be explicitly cast to the appropriate type. In C, the return value need not be explicitly cast, which could lead to errors if you later cast the void pointer to the wrong type.

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

void means nothing and it does exactly that.. for example...

the function declaration:

void function_name(int)

tells c compiler that the user defined function named function_name will take an integer as an argument and after completion of task would return nothing...

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

void means that the function you are trying to use or/and define does not return arguments.

This answer is:
User Avatar

User Avatar

Wiki User

6y ago

A void function is simply a function that returns no value.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is mean void in c plus plus?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How does the use of the 'void' keyword differ in C plus plus vs. C?

It doesn't. Void has the same meaning in both.


Difference between void and devoid in c plus plus?

There is no such thing as devoid in C++.


What use of void data type in c plus plus?

doesn't return the value.


Which Program that will run in C but not in C plus plus?

void main() { int *x = malloc(sizeof(int) * 10); }


C plus plus program that will count?

#include int main (void) { puts ("1 2 3"); }


How do you use call by reference in c plus plus?

Call by reference means calling a function using a reference to a variable or a pointer. You call a function by passing refrences to a variable. For eg: void x(int &a) { a=2; } void main() { int s=3; x(s); } OR void a(int &c) { c=5;}void main(){ int *p; *p=2a(*p);}


Show the simple c plus plus program?

int main (void) { puts ("Hello, world"); return 0; }


How do you check Address of integer in c plus plus?

void myfun (int *pi){if (i==NULL) printf ("check failed");}


What is CPU usage small programm c plus plus?

Example: int main (void) { LOOP: goto LOOP; }


How to swap two numbers by call by reference in c plus plus?

void swap(int& a, int& b ) { a^=b^=a^=b; }


How do you rectify the waring is function should return a value in turbo c plus plus?

By returning a value. Or using type 'void'.


Any program in c plus plus without using any header file?

For example: int main (void) { return 0; }