Mail Archives: djgpp/1997/06/12/07:42:12
Kristian Dorland wrote:
> I have just installed djgpp for the first time, and I can4t create c-
> programs that4s working properly. Every time I run a program compiled
> with djgpp, there is somthing wrong with the contents of the integers
> and the floatings. An example:
>
> main()
>
> {
> int one == 1234;
> printf("%d",one);
> }
Well, of course the compiler will get confused because you've called
the variable 'one' and then expected it to hold 1234. Try renaming
the variable to 'onetwothreefour' so it knows what the value is.
Or as a last resort you could read a C manual and find out the
difference between '=' and '=='. But I doubt that's your problem
because you say the compiler doesn't give an error. It does if I try
to compile your program as stated. If, in fact, you had:
main()
{
int one;
one == 1234; // should be one = 1234;
printf(%d", one);
}
then that would be the answer.
Or if you declared it as a float and then printed it using "%d".
Chris
- Raw text -