COMPUTER SCIENCE AND ENGINEERING
DATA STRUCTURES
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
No statement
|
|
No function
|
|
No program
|
|
No value
|
Detailed explanation-1: -The void keyword specifies that a method should not have a return value.
Detailed explanation-2: -When used as a function return type, the void keyword specifies that the function doesn’t return a value. When used for a function’s parameter list, void specifies that the function takes no parameters. When used in the declaration of a pointer, void specifies that the pointer is “universal."
Detailed explanation-3: -In such situations, we can use the pointer to void (void pointers) in C++. For example, // void pointer void *ptr; double d = 9.0; // valid code ptr = &d; The void pointer is a generic pointer that is used when we don’t know the data type of the variable that the pointer points to.
Detailed explanation-4: -void is a Java keyword. Used at method declaration and definition to specify that the method does not return any type, the method returns void . It is not a type and there is no void references/pointers as in C/C++.