Linux Mall - The Linux SuperStore!
Linux books, Linux CDs, Linux toys, you name it, they have it!

W W W . L I N U X D O T . O R G

Diary of an Open Source Newbie
Part 2
[ Home ] [ Contents ] [ Previous ] [ Next ]
Introduction

It goes without saying that if you want to fully understand Linux you should definately consider getting into C. After all, that is what the kernel's source code is written in.

Apologises if these notes appear terse, or technical. I've been programming on and off now for almost 13 years, and all that "programming mumbo-jumbo" has always come naturally to me. Besides, they are supposed to be nothing more than detailed notes to help jog your (and my) memory, and not a C tutorial. Writing an online C tutorial, GTK+ tutorial etc. would be pointless since many excellent ones exist already. The best of which, I'll point out on our travels. ;)

As far as I know, no other site covers training you to program in Linux from beginner to "whatever" (at least not in the way I plan), so you're lucky you found this site. ;)

To compile your first C program in Linux and retrieve the online C manual I'm describing below, click here.


----[ 15TH SEPTEMBER

Read Chapter 1. Discovered the following:

IDENTIFIER RULES:

  • Can use A-Z, a-z, 0-9, _, but don't start with a number.
  • To prevent possible name clash with compiler's internal identifiers, do not start with a _ .
  • Case-sensitive.
  • 31 character max (any after may be ignored).

KEYWORD RULES

  • Always in lowercase.

----[ 18TH SEPTEMBER

Read Chapter 2. The following program I wrote, sums up the entire chapter - displaying: the form of a C program; the use of comments; how to declare, and assign integer variables; and the printf command's syntax required to display integer variables, and text.


#include <stdio.h>

int main() /* A C program always begins by executing the function main. */
{
  int apples; /* 1. Declare an integer variable called: apples. */
  int pears;
  apples = 1; /* 2. ...and assign it a value of 1. */
  pears  = 2;
  printf("Apples: %d\n\nPears : %d\n", apples, pears); /* Example multiple
                                                          line comment. Note
                                                          that \n means,
                                                          "start new line". */
  return 0;
}


          

Output of above program:


Apples: 1

Pears : 2


        
[ Home ] [ Contents ] [ Previous ] [ Next ]
Homepage | The Last 5 Days | The Daily Linux News | The Linux Bits | Newbie's Linux Manual
The Best Linux Sites | Linux Book Reviews | A Windows Vendetta?
Diary of a Linux Newbie | Diary of an Open Source Newbie
The Linux Forum | Just For Fun Amazon - The World's Biggest Bookstore!
4.7 million books, CDs, videos, and DVDs available to buy! Webmaster
© 1999 Linuxdot.org -