I have a function that should calculate the size of an array. However, the results is removing elements from my array.
int USERHAND[] = {8,3,4,5};
std::cout << FoundationLayer::HandSize(USERHAND); // 1st way
std::cout << sizeof(USERHAND) / sizeof(USERHAND[0]); // 2nd way
// Function for the 1st way
int HandSize(int* Hand) {
return sizeof(Hand) / sizeof(Hand[0]);
}
The output for 1st way is 2 & the output for the 2nd way is 4