Upcoming Events
Unite 2010
11/10 - 11/12 @ Montréal, Canada

GDC China
12/5 - 12/7 @ Shanghai, China

Asia Game Show 2010
12/24 - 12/27  

GDC 2011
2/28 - 3/4 @ San Francisco, CA

More events...
Quick Stats
85 people currently visiting GDNet.
2406 articles in the reference section.

Help us fight cancer!
Join SETI Team GDNet!
Link to us Events 4 Gamers
Intel sponsors gamedev.net search:

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.



Page 4

Contents
  Introduction
  Page 2
  Page 3
  Page 4
  Page 5
  Page 6
  Conclusion

  Source code
  Printable version
  Discuss this article

The Series
  Part 1