what is wrong with my program

Light Poster
12Jun2009,06:12   #1
xzibit2313's Avatar
I am a noob
and this is my first post
so hello


and i would like to know if you can tell me what is wrong with my code
i am just starting c so her is my C program
Code:
#include <stdio.h>

int main(void)
{
    // insert code here...
    printf(“Why does every programmer look like this...\n”);
    printf(“~~\n”);
    printf(“-00-\n”);
    printf(“-\n”);
    printf(“U\n”);
    return 0;
}
the compiler puts the words
error: syntax error at 'OTHER' token
below every
line that has printf on it
~ Б0ЯИ Τ0 С0δЭ ~
12Jun2009,06:38   #2
SaswatPadhi's Avatar
Try this : (It might look same, but after careful observation, you can spot the difference(s) )

Code: C
#include <stdio.h>

int main(void)
{
    // insert code here...
    printf("Why does every programmer look like this...\n");
    printf("~~\n");
    printf("-00-\n");
    printf("-\n");
    printf("U\n");
    return 0;
}
Copy the exact code above and paste in your IDE and compile it. Tell me the result.
Go4Expert Member
12Jun2009,06:53   #3
stylishkishore's Avatar
Quote:
Originally Posted by SaswatPadhi View Post
Can you please tell me what is the difference between the above and yours code.
I think " " are the first.And syntax highlight is second one.Am i right?
~ Б0ЯИ Τ0 С0δЭ ~
12Jun2009,07:00   #4
SaswatPadhi's Avatar
Yeah, you are right !

" " should enclose strings and not “ ”.
Light Poster
12Jun2009,07:01   #5
xzibit2313's Avatar
haha i see with the quotes whoops well i wrote the code in a text editor and the i copied it and pasted into the compiler thx tho
~ Б0ЯИ Τ0 С0δЭ ~
12Jun2009,07:05   #6
SaswatPadhi's Avatar
Welcome to G4EF, xzibit2313.
Light Poster
12Jun2009,07:06   #7
xzibit2313's Avatar
Code:
#include <stdio.h>
int main (void)
{
	printf("\n2+2= %d”, 2+2");
	return 0;
}
now what is wrong with that code i am trying to add 2+2 and display it
~ Б0ЯИ Τ0 С0δЭ ~
12Jun2009,07:14   #8
SaswatPadhi's Avatar
LOL, I think you are confused with printf syntax.

Try this :

Code: C
#include <stdio.h>

int main()
{
      printf("\n2+2 = %d", 2+2);
      return 0;
}
Light Poster
12Jun2009,07:39   #9
xzibit2313's Avatar
Oh I see all I had to do was remove that last quote .
Thx a bunch I'm sure I'll have many more questions tomarrow

Are their any good c tutorials on here
~ Б0ЯИ Τ0 С0δЭ ~
12Jun2009,07:42   #10
SaswatPadhi's Avatar
Sure, there are many.

shabbir mentions them here : http://www.go4expert.com/showthread.php?t=107