void in c programming

Posted under C++ Course On By mohammed.mutawe

void in c programming

It is a function of a function that does not return a value, but rather processes the values ​​inside. It is called a void function because it does not return values, unlike retrograde functions.


Use of void

Its use is a lot in the language, as it affects the values ​​defined in the code in general or the view of the code editor. For example, when defining a variable of type int and reusing it in invalid functions, the function affects its value or finishes processing and puts the value of that processing inside This variable is to be used elsewhere.



Please, to understand the invalid functions well, copy the following code into your code editor.

/* static variabe with Class */
using namespace std;

int val = 5;

void var()
    val = 10;


int main() {


     std::cout << "Your Value is : " << val << endl;

    return 0;


Leave a comment

Your email address will not be published. Required fields are marked *