E
ext_u
I'm trying to learn C from "The C Programming Language" (by K&R) and I
am about halfway through the first chapter.
I am using Miracle C as my text editor and compiler.
Up until this point everything was working fine, but now the book has
started into Line and Word counting programs. I am entering the
programs into the text editor exactly like they are in the book and
they are not working right at all. They compile fine and when I run
them they do no produce any output like they should be. Its strange.
I think it may be my compiler. Someone recommended my using DJPGG (i
think it was called) and I tried to install and run that program but
it seems way way way to complicated for me and I have noone who can
show me how to get it to run properly.
This is the line counting Prog:
#include <stdio.h>
main()
{
int c, nl;
nl = 0;
while ((c = getchar()) != EOF)
if (c == '\n')
++nl;
printf("%d\n", nl);
}
When I type things into the cmdprompt it will not give me any output (
i guess its called) Its almost like the printf cmd isnt there and it
is just taking in the data and not displaying anything. The word
counting program was basically the same and gave me the same result.
I enter something , hit enter and instead of printing anything on the
screen it pauses for a moment and then moves down to the next line.
Its frustrating. There is also wc program that comes straight from
UNIX in the book and when I enter the code exactly as it is in the
book into my compiler I get a weird error like it thinks the word OUT
is the number 0. Very strange....
I think the problem is my compiler. Can anyone recommend a good and
easy to use C compiler/text editor??
am about halfway through the first chapter.
I am using Miracle C as my text editor and compiler.
Up until this point everything was working fine, but now the book has
started into Line and Word counting programs. I am entering the
programs into the text editor exactly like they are in the book and
they are not working right at all. They compile fine and when I run
them they do no produce any output like they should be. Its strange.
I think it may be my compiler. Someone recommended my using DJPGG (i
think it was called) and I tried to install and run that program but
it seems way way way to complicated for me and I have noone who can
show me how to get it to run properly.
This is the line counting Prog:
#include <stdio.h>
main()
{
int c, nl;
nl = 0;
while ((c = getchar()) != EOF)
if (c == '\n')
++nl;
printf("%d\n", nl);
}
When I type things into the cmdprompt it will not give me any output (
i guess its called) Its almost like the printf cmd isnt there and it
is just taking in the data and not displaying anything. The word
counting program was basically the same and gave me the same result.
I enter something , hit enter and instead of printing anything on the
screen it pauses for a moment and then moves down to the next line.
Its frustrating. There is also wc program that comes straight from
UNIX in the book and when I enter the code exactly as it is in the
book into my compiler I get a weird error like it thinks the word OUT
is the number 0. Very strange....
I think the problem is my compiler. Can anyone recommend a good and
easy to use C compiler/text editor??