I am having trouble finding a way to get the array size from within a function. Here is my code:
#include
void printBuff(char *buf);
int main()
so here are my answers for your questions:
char*
type when passed into the function (with the char* parameter).strlen
function for strings. Otherwise, you have to pass the length as parameter.Don't use sizeof(buf)/sizeof(buf[0])
to get length of an array when passing array parameters. See this. for more information.