Thursday, April 16, 2015

C Program Structure:

  1. Preprocessor Commands (hiền xử lý: #include, #define, #if, #ifdef, ....)
  2. Functions (hàm, conn trỏ hàm, hàm inline, ...)
  3. Variables (scope: global, local; type: char, int, float, double, void; class: auto, register, static,extern)
  4. Statements (if, if ...else, elseif, switch, while, do, for loop) 
  5. Expressions ( arithmetic, assignment, logical, bitwise, ...)
  6. Comments (/* block comment */, //line comment)

C Hello World (helloworld.c)
 #include <stdio.h>  
 int main()  
 {  
   /* my first program in C */  
   printf("Hello, World! \n");  
   return 0;  
 }  

Compile and Execute
  1. cd
  2. gcc helloworld.c  (compile)
  3. ./a.out  (execute)
hoặc
  1. cd
  2. gcc helloworld -o helloworld
  3. ./helloworld 
Ký tự ./ chỉ ra thư mục hiện tại 





Leave a Reply

Subscribe to Posts | Subscribe to Comments

- Copyright © Lập trình hệ thống nhúng Linux . Powered by Luong Duy Ninh -