Functions with Empty Parameter Lists - C++ Function

C++ examples for Function:Function Parameter

Description

Functions with Empty Parameter Lists

Demo Code

#include <iostream>

void function1();
void function2(void);

int main(int argc, const char *argv[]) {
    function1();// w  w w .j av  a 2  s  .com
    function2();

    return 0;
}
void function1() { 
   std::cout << "function1 takes no arguments" << std::endl; 
}

void function2(void) {
    std::cout << "function2 also takes no arguments" << std::endl;
}

Result


Related Tutorials