13. รูปโครงสร้างโปรแกรม #include <stdio.h> /* Library File Access */ main() /* Function Heading */ { int i; /* Variable Declaration */ printf(“This is struture of C language”); /* Statement */ }
14.
15.
16.
17. ตัวอย่างการเขียน Comment #include <stdio.h> main() // Function Heading { int i; printf(“This is struture of C language”); // this is statement }
18. ตัวอย่างการเขียน Comment /* my first program by Jakkapan Madeetrakul hahahaha */ #include <stdio.h> /* the comment comment comment */ main() { int i; printf(“This is struture of C language”); } ใช้ 2 แบบปน ๆ กันในไฟล์เดียวกันก็ได้
19.
20.
21.
22. ตาราง Keyword ในภาษาซี while struct union short goto double case void sizeof int enum const volatile static long extern continue unsigned signed if else char typedef return for do break switch register float default auto
23.
24. Data Types 2 ตัวเลขจำนวนเต็ม unsigned 8 ตัวเลขทศนิยม double 1 ตัวเลขจำนวนเต็ม short 4 ตัวเลขจำนวนเต็ม long 1 ตัวอักษร 1 ตัว char 4 ตัวเลขทศนิยม float 2 ตัวเลขจำนวนเต็ม int ขนาด ( ไบต์ ) คำอธิบาย ประเภทข้อมูล
28. Expressions a + b x = y c = a + b x == y ++i เป็นการสร้างนิพจน์ที่แทนข้อมูล 1 ตัว อาจเป็นตัวเลข ตัวอักษร โดยนิพจน์อาจเประกอบด้วย ตัวแปร ค่าคงที่ อะเรย์ หรือการเรียกใช้ฟังก์ชัน เป็นต้น หรือมีตัวดำเนินการร่วมอยู่ก็ได้
31. การทดลอง /* This first example program for C */ #include <stdio.h> main() { printf("Hello, Welcome to C Language"); } 1
32. การทดลอง /* Example for C */ #include <stdio.h> main() { int i , area = 0; float sum; char c; c = ‘B’; i = 5; printf("") ; printf("Value i = %d and area = %d", i, area); printf("Value sum = %f and c = %c", sum, c) ; } 2
33. การทดลอง #include <stdio.h> #define fifty 50 #define Text ‘C’ main() { int a , b ; float total; char c , name[10]=”Turbo C”; c = 65; a = 44; b = 56; total = 1500; printf(" c = %d and c = %c", c, c) ; printf(" a + b = %d and b - a = %d", a+b, b-a); printf(" total / 50 = %f", total/fifty) ; printf(" %s %c", name , Text) ; } 3
34. การทดลอง /* program to calculate area of a circle */ #include <stdio.h> #define PI 3.14159 main() { float radius, area ; printf("Radius = ?") ; scanf("%f", &radius) ; area = PI * radius * radius; printf("Area = %f ", area) ; } 4
35. การทดลอง #include <stdio.h> main() { char f_name[20], l_name[30]; printf("Enter your first name : ") ; scanf("%s", f_name) ; printf("Enter your last name : ") ; scanf("%s", l_name) ; printf("Your name : %s %s",f_name,l_name) ; } 5
36. Click to edit company slogan . Q & A (Question & Answer)