char* username
is a pointer to the beginning of a character array (in c).
How do I calculate the size of the array, is there is function that can do it?
char* username
is a pointer to the beginning of a character array (in c).
How do I calculate the size of the array, is there is function that can do it?
use strlen(username). But the array has to terminated by '\0'. Otherwise you cannot do that.
You can't do that. If this is an array you allocated, you should have the size of it to start with. For what C and the compiler know, this is just a pointer.
If this is a null-terminated string, use strlen to count it's non-null characters, then the array length is at least length + 1 characters.
If you have the array base pointer, you could use sizeof(pointer) to get the size allocated to it by the memory manager.