The following code returns 8 followed by 26, the second number obviously being correct and first being wrong despite having identical code. Any ideas what's wrong with my getarraysize function?
Code:
static char key[26] = {'r','t','c','t','b','f','n','l','a','f','s','t','t','t','s','e','a','n','i','m','(','m','o','c','i','r'};
int getarraysize(char *input) {
int output;
output = sizeof(input) / sizeof(input[0]);
return output;
}
int main(int argc, char *argv[]) {
cout << getarraysize(key) << "\n";
cout << (sizeof(key) / sizeof(key[0]));
return 0;
}