First off, fflush(stdin) is undefined. Flushing a stream is only valid for output streams, or update streams when the last operation was a write.

As for your main question, the sizeof is applied to the parameter value (in this case, a pointer). The sizeof operator can't work out how much data a pointer points to (see example). Using [ ] instead of pointer notation in your function declaration doesn't change anything.

void foo ( const char *a ) {
  printf("%lu\n", sizeof(a) );
int main ( ) {
  char a[] = "hello";
  char b[] = "this is a longer string";
  return 0;
Also see