Why do we not pass the address of the string during printf or scanf functions like we do for Integer or float variable types?
Thanks in advance.
This is a discussion on Simple String question within the C Programming forums, part of the General Programming Boards category; Why do we not pass the address of the string during printf or scanf functions like we do for Integer ...
Why do we not pass the address of the string during printf or scanf functions like we do for Integer or float variable types?
Thanks in advance.
But you DO pass an address.
You just don't use the & address-of operator.
Code:char message[] = "hello"; printf("%s",message); // is the same as printf("%s",&message[0]);
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
I support http://www.ukip.org/ as the first necessary step to a free Europe.
Oh my. I missed that completely. Thanks a lot.