programming:c:hello_world
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
programming:c:hello_world [2013/08/05 15:58] – zufd | programming:c:hello_world [2014/12/11 16:10] – czuber | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Hello world ! ====== | ====== Hello world ! ====== | ||
- | ===== Exercice 1 ===== | + | ===== Exercice 1 : printf |
* Open a terminal | * Open a terminal | ||
Line 64: | Line 64: | ||
* Run it again | * Run it again | ||
* Hello world ! | * Hello world ! | ||
+ | ===== Exercice 3 : scanf ===== | ||
+ | |||
+ | * Open a terminal | ||
+ | * Create your file by writing the following command | ||
+ | <code c> | ||
+ | vim ex3.c | ||
+ | </ | ||
+ | * Enter insertion mode by pressing Insert | ||
+ | * Write the lines below | ||
+ | <code c> | ||
+ | # | ||
+ | |||
+ | int main(int argc, char** argv) | ||
+ | { | ||
+ | char nom[14]; | ||
+ | printf(" | ||
+ | scanf(" | ||
+ | printf(" | ||
+ | | ||
+ | return 0; | ||
+ | } | ||
+ | </ | ||
+ | * Then press Esc key | ||
+ | * Write :wq | ||
+ | * Compile your code with the following line | ||
+ | < | ||
+ | gcc -Wall ex3.c -o ex3 | ||
+ | </ | ||
+ | * Then run your programm by typing " | ||
+ | ===== Exercice 4 : for ===== | ||
+ | |||
+ | * Open a terminal | ||
+ | * Create your file by writing the following command | ||
+ | <code c> | ||
+ | vim ex4.c | ||
+ | </ | ||
+ | * Enter insertion mode by pressing Insert | ||
+ | * Write the lines below | ||
+ | <code c> | ||
+ | # | ||
+ | |||
+ | int main(int argc, char** argv) | ||
+ | { | ||
+ | int nbrMax; | ||
+ | int i = 1; | ||
+ | printf(" | ||
+ | scanf(" | ||
+ | printf(" | ||
+ | for(i=1; | ||
+ | { | ||
+ | printf(" | ||
+ | } | ||
+ | | ||
+ | return 0; | ||
+ | } | ||
+ | </ | ||
+ | * Then press Esc key | ||
+ | * Write :wq | ||
+ | * Compile your code with the following line | ||
+ | < | ||
+ | gcc -Wall ex4.c -o ex4 | ||
+ | </ | ||
+ | * Then run your programm by typing " |
programming/c/hello_world.txt · Last modified: 2014/12/11 16:22 by czuber