The sizeof trick only works when the compiler knows the size of the array at compile time. In this case, the compiler knows the size in main since it sees that thisOne is declared as int[7]. In the case of the function, the compiler only sees the declaration of firstArray as int[]. So the compiler treats firstArray as a pointer, so sizeof(firstArray) == sizeof(int*) == 4.