There are many languages. On machines the p=most important difference are: * Interpreted language the source code enters the interpreter and exists there (no exec file) * Compiled language the creation process is in only one time (when you create it you must write in one language -source code) source code -> compiler ->> executable file the software can be executed without the compiler * For writing a software you need to know your machine. You need an editor and an environment If you change the platform on an interpreted software you can execute it on another machine, but not on a compiled thing. C is portable, if you write it on the correct way... but it's a nxt month stuff * environment * gcc gcc test.c -> a.out gcc test.c -o test -> test gcc test.c -Wall -o test -> test prints all warnings * editor * bash For executing the file, you do ./test HELLO WORLD ================================ #include int main (void) { printf ("hello world\n"); return 0; } ================================ The indentation is only a style question so it is realy important!! STYLE = it is VERY important. anyone can chose his style, what he likes and prefer, but it has to be consequent, so that the code is readable 1 #include line 1: asks to use the standard input-output - gcc does it for you if you don't 2 int main (void) { line 2: the software starts with the main function (contained on the {}) any function can return a value. now we have just one function, but can be more. the software returns a value to the system. int is an integer value. why? because the OS needs to know if the sofware has been executed. any software without error returns 0. the only exception is the kernel, that don't returns anything. main (void): any sofware needs values. if your software don't receive values, then you must write void or nothing. 3 printf ("hello world\n"); printf is a function and prinst something on the screen. we can use it because we put the { one of the more complex functions on the standard input library (stdio.h) because the syntax is (what,arguments) 4 return 0; for the OS to know that everything is ok. 5 } you close the funtion printf: one of the more complex functions on the standard input library (stdio.h) the syntax is (what,arguments) _what_ is here "hello world" the first argument of printf has to be a string for writing more complex things are the scaping symbols (\) what i need to write what i want \" " \n new line \t tab \r carriage return \\ \ %% % %c a single caracter %d a _numeric_ argument ================================ #include int main (void) { int numb = 12; // a variable with a name (numb). variables are case sensitive printf ("numb contains "); printf ("the value %d\n",numb); return 0; } ================================ * Elements have to be divided by semicolons printf ("the value %d\n",numb); %d : get the first _numeric_ element in the list of arguments (ergo, numb) (what,arguments) In C a string (like "hello world") must be contained between brackets. The first argument of printf MUST be a string. CHARSET: a numeric chart of your characters ASCII is one of them. Contains all the symbols on a UK kbd. And a computer can consider them as numbers. When the computer needs to print them thinks about the symbols as numbers. If I want to print the value of a character Like printf ("'A' is %d\n",'A'); ================================ #include int main (void) { printf ("%c in numeric value is %d\n",'A',65); printf ("'A' is %d\n",'A'); printf ("\n"); return 0; } ================================