> > | #include “myOwnIncludeFile.h”
The C main program
As a first example people usually write the
“Hello World” program
#include <stdio.h>
void main() {
printf(“Hello World!\n”);
}
Let us try to compile and execute this program
First we start the editor, we type and save the program,
then we compile it using the gcc compiler and finally we execute it.
C data types
- C has a number of data types:
- char, short, int, long, float, double
- unsigned char, unsigned short, unsigned int
- can be extended to boolean (in C99 you can #include <stdbool.h>
- No strings! But a pointer to a zero terminated chain of characters
- struct
- union
- enum
And you can define your own data types with typedef
Assignements
We modify the program to do some calculation:
|