InterviewSolution
| 1. |
When is the "void" keyword used in a function |
|
Answer» The keyword “void” is a data type that literally represents no data at all. The most obvious USE of this is a FUNCTION that RETURNS nothing: void PrintHello() { PRINTF("Hello\n"); return; // the function does "return", but no value is returned }Here we’ve declared a function, and all functions have a return type. In this case, we’ve said the return type is “void”, and that means, “no data at all” is returned. |
|