answersLogoWhite

0


Best Answer

when we declare any function with void,it doesnt return any value

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the purpose of the keyword void in a function declaration?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What do you mean by moving the static function declaration before the function body?

Before:static fun (void) {...}After:static fun (void); /* moved here */....static fun (void) {...}


Application of void data type in c plus plus programming language?

The voiddata type is used when a function doesn't return any value, and/or when it has no parameters at all. Pointer type 'void *' is a generic pointer.A void pointer is used when it needs to be assigned to different data types later on in a program. Since it avoids type checking, void pointers should be used with care.


What does a void method do?

In Java, this keyword is used to specify that the method has no return value.


What is meant by void abcint?

void abc(int); is a function declaration. The declared function has no return value, is named abc and accepts one integer argument by value.


Which keyword is placed within the parenthesis of prototype and definitions if the function does not use arguments?

you can leave it blank or u can use void


How do you call a member function of one class in another class using friend function?

class B; // forward declaration. class A { private: void myFunction(B b){b.myFunction();} // Calls private method in b. }; class B { friend void A::myFunction(B b); // Friend function declaration. private: void MyFunction(); };


What is the use of void pointer?

Void Pointer is a General purpose pointer ,that does not have any data type associated with it and can store address of any type of variable. Declaration: void * pointer_name;


What are the functions of 'C'?

Pieces of program-code, they are identified by their names. Example for function-declaration: int main (void); Example for function-definition: int main (void) { puts ("Hello, world!"); return 0; }


Is global variables are declared within the main function?

Might be, but don't forget the keyword 'extern':int main (void){extern int errno;...}


The keyword indicates that a method does not return a value?

void


What are the applications of void data types inc plus plus?

void data type is used in function declaration. It can be explained by examle void add(int,int); this will tell the compiler that no value is going to be returned by the function. int add(int,int); this indicates that an integer type value will be returned by the function


What will be the prototype of a user defined function?

In C programming, there are no built-in functions; all functions are user-defined. In order to use a function it must first be declared. This can be achieved by importing the header file containing the declaration (via the #include compiler directive) or by typing the declaration by hand. The definition (implementation) of a function is not required in order to use a function, but if a function is used it has to be defined somewhere (undefined functions will cause a link error). Where a function is used by several translation units, placing the declaration in a header file ensures the declaration is consistent across all translation units. Grouping declarations by purpose allows us to import several declarations at once. Declarations that are not used are simply ignored. A declaration informs the compiler of the function's name and type, and the number and type of its arguments, if any. This describes the interface to the function. A function's type is denoted by its return type. A function that has no return value is simply declared void (no type). The return type always comes first in a declaration, followed by the function name, which must be a unique identifier within the scope in which it is declared (global or local scope). A local name will mask a global name, effectively hiding it from the local scope. Function arguments (the formal arguments of the function) are delimited by parenthesis after the function name. A single argument of type void denotes no arguments while multiple argument types must be separated by commas (void types are not permitted in a multiple argument function). The complete declaration is terminated by a semi-colon immediately after the closing parenthesis. If the declaration is also a definition, the function body (the implementation) replaces the closing semi-colon. To assist with documentation, the formal arguments of a declaration may be named (unless the argument is void). However, where names are given, they need not match the corresponding names provided by a function's definition, where defined separately. Using longer descriptive names in the declaration helps document their purpose, while the definition can use shorter names that are easier to work with.