Question:
why won't my C code compile?
anonymous
2012-05-16 18:57:34 UTC
I just started learning ANSI C programming, and figured I would try to use what I have learned so far, in something simple., so I made this:
#include

int main ()

{
int x=;
int y=;
if x=1, y=0;
printf ("what is x?");
scanf ("%d") x;
printf ("%d, ") y ;
return 0;
}

but it won't compile, I search and search but can't seem to find the reason why, please help
Three answers:
tbshmkr
2012-05-16 19:58:16 UTC
Throw the tutorial/text you are using. Specify the compiler you are using && the errors.

=

Use any of these.

=

Books:

Programming in C by Stephen G. Kochan

=

Tutorials online:

The GNU C Programming Tutorial

- http://www.linuxtopia.org/online_books/programming_books/gnu_c_programming_tutorial/index.html

Learning GNU C

- http://www.linuxtopia.org/online_books/programming_books/learning_gnu_c/index.html

-

Code::Blocks == Open Source C/C++ IDE

- - codeblocks-10.05mingw-setup.exe

- http://www.codeblocks.org/downloads/binaries
Cronin
2012-05-16 19:18:31 UTC
well ... for starters nearly every line is incorrect. try this





#include



int main ()



{

int x=0;

int y=0;

printf ("what is x?: ");

scanf ("%d", &x);

printf ("%d", x);

return 0;

}
roger
2012-05-17 07:44:12 UTC
lotsa problems

this should work better



#include



int main ()



{

int x=0;

int y=0;

printf ("what is x?");

scanf ("%d",&x);

printf ("%d,\n", y) ;

return 0;

}



hthere are some examples

tp://www.c-program-example.com/p/k-and-r-c-programs.html


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...