any way to determine size of array thats a function parameter?
Hi, I have a function that accepts as its argument a pointer to a character array, and writes some values to it.
i'd like to check the size of it (the number of elements) to make sure I don't overwrite past its boundaries
Something like: sizeof(array)/sizeof(char) only works if the code is executed in main and the array is declared inside of main
sizeof(array)/sizeof(char) does not work inside a function, because the compiler treats the passed in array as a pointer, and returns the size of the pointer, not the array.
Note: I'm not using strlen because I want to check the actual size of the array, not the length of the string.