I have a simple question. I dont understand why this is not printing an 'a' to the screen i think it is giving me a K .
Code:#include <stdio.h> int main (void) { char a; a= 'a'; printf ("%c", &a); return 0; }
I have a simple question. I dont understand why this is not printing an 'a' to the screen i think it is giving me a K .
Code:#include <stdio.h> int main (void) { char a; a= 'a'; printf ("%c", &a); return 0; }
> a= 'a';
Don't you need the regular "double" quotes such as the ones that surround the word double in this sentance?
> printf ("%c", &a);
This shouldn't have the & sign.
The world is waiting. I must leave you now.
Try this: Remove the & before the a in printf(). Putting the & in front of the name of the variable, gives the address of that variable, not the value.
if i use double quotes it gives me this error
warning: assignment makes integer from pointer without a cast
>Don't you need the regular "double" quotes such as the ones
>that surround the word double in this sentance?
That is for strings, he is using a single character.
ty guys the use of single quotes and removing the & worked.