What does this function do ?
inline bool myFunc(int aVal) {return aVal & 1;}
Edit I have edited the code to be runnable.
What does this function do ?
inline bool myFunc(int aVal) {return aVal & 1;}
Edit I have edited the code to be runnable.
Keyword inline
shall be written with lower case letters.
inline bool myFunc(int aVal) {return aVal & 1;}
The function returns true
if the first bit of the value aVal is set to 1. Otherwise it returns false
.
Using this function you can check for example whether aVal is odd or even number. :) If the function will return true
then it means that the number is odd.
The operator & is bitwise AND operator.