Here's the first C program you will write. It is is a short program. I promise it will be easy. You will need an ASCII editor, to enter the text. Some good editors help you in writing source code by automatically indenting the code, highlighting the commands, giving you direct access to the compiler and so on. Get a GOOD editor. A bad one is really a pain! I prefer the very quick JED/XJED editor. It is fast and small, not a second OS-layer like the EMACS. And not that cryptic like vi. NOTE: Carolyn is totally right here: IT IS IMPORTANT to learn to use vi, cause it is the one you will find on any *NIX system. On the other hand it comes from ancient *NIX (*NIX stands for all the different kinds of Unix like Linux, Irix, Ultrix, AIX, BSD, OpenBSD, FreeBSD, NetBSD, etc. etc.) times, its command structure is very powerful and awful IMHO. Newbie note: Pico is a great newbie editor, and is also available in many Unix shells. We won't make too much fun of you if we catch you using it. Type this into your favorite editor in your Unix shell account: #include<stdio.h> #include<stdlib.h> main() { printf( "Hello, Hackers!\n" ); #if __STDC__ printf( "May I introduce myself: I am a compiler of the new version! \n" ); printf( "I am an ANSI compiler\n" ); #else printf( "I am an old K&R compiler!\n" ); #endif } Save the text in a file called "HelloHackers.c". Time to compile the human readable text, our first source code into machine readable assembly language. Time to work, compiler! Type at the commandline of your account the following command sequence: cc -o HelloHackers HelloHackers.c This will call the compiler and tell it to take "HelloHackers.c" and compile ( = translate) it into an executable program called "HelloHackers". Now check, whether the program really runs! Type: HelloHackers Maybe you will get an error message here, like: HelloHackers: command not found This looks like a path error. See the GTMHH, Programmers' Series, Number 2 for some ideas on path statements, or ask tech support at your ISP. To execute the program despite the fact, whether you have got this error type: ./HelloHackers Now you will get an output. This will be either Hello, Hackers! (May I introduce myself: I am a compiler of the new version! I am an ANSI compiler.) or Hello, Hackers! (I am an old K&R compiler!) Nice, isn't it? ### 4.0 C compiler vs. C compiler |