Which keyword is used to define a function in C++?
- class
- struct
- define
- void
In C++, the keyword to define a function isn't necessarily a specific reserved word like "class" or "struct". Instead, functions begin with their return type, such as "void" for functions that don't return any value. But it's worth noting that "void" is just one possible return type, and not strictly a keyword exclusively for function definition.
Loading...
Related Quiz
- A game has a scoring system where players earn points. The game needs a feature to evenly distribute bonus points among players and also determine any remaining points that can't be evenly distributed. Which arithmetic operator is essential to determine the number of leftover points?
- How does C++ handle char literals that are assigned to unsigned char variables?
- Which class is primarily used for performing input operations on files in C++?
- What is the purpose of the this pointer in C++?
- In C++20, using enum with _______ allows specifying the underlying type and scope.