Wednesday, February 24, 2010

I like to dabble in C, and I wrote and compiled my first C program in linux using gcc. Here it is.

#include < stdio.h>
main()
{
printf("this is a test \n");
printf("my name is\n");
printf("Mickey mouse\n");
}

I brought up a Linux shell and I compiled my hello.c program my typing cc -o hello hello.c in the bash shell. Then to run it, I typed ./hello. The dot back slash with no spaces is important!

I finally learned how to compile a C program!

No comments:

Post a Comment

Followers

Blog Archive

About Me

My photo
Biking helps me to cope with life.