Let's be savage beasts and dive right into the code, ok? Sounds good to me. /* linux-helloworld.c */ #include <stdio.h> /* Include the Standard IO Header */ int main() { char cAnswer; /* A Character to Prompt at Exit */ printf("Hello Fellow Linux Users!"); /* Every Program has it */ scanf("%c",&cAnswer); /* Make Sure the Program doesn't Quit Immediately */ return 1; /* Exit After it Detects the Character */ } You'll notice a few things at first. Some of them are most likely: 1) The use of C instead of C++. Even though Linux does have C++ libraries, C is more commonly used. C is much more standardized. C is basically as standardized as you can get with a programming language (By Standardized I mean it is ANSI Compliant). Linux can handle C++ fine, it's just more common to use C because most of Unix/Linux/BSD were written in Assembly and C, thus proving it as the native language. 2) The c in cAnswer. The c stands for character (char). I hope you catch where I'm going with this...That's right! Hungarian Notation! Many Linux people do not like Hungarian Notation...I'm not really sure why. You can use it if you want, but I plan on using it in the tutorial just for clarity? Ok? Ok. Well there you go. Now you're saying "Hey Wait! That's how I did it on Windows too!". *grin* Duh! That's just standard C. But just you wait! This article has just begun. On the next page, we'll get into compiling and after that, distributing! Fun, Fun, Fun! So please, read on, grasshopper.
|
|