Just use sizeof() in all those functions. There's a reason why this function got introduced. There's no need for you to go look for the correct size. Whatever size u give the array, sizeof() will always get the correct size, no matter where your array got declared.