วันเสาร์ที่ 11 มกราคม พ.ศ. 2557

สวัสดีชาวโลก

         ในการเริ่มเขียนโปรแกรม ซึ่งที่สำคัญที่สุดก็ Syntax ของภาษา ซึ่งในแต่ละโปรแกรมก็จะมี Syntax ที่แตกต่างกันออกไป ทุกภาษาจะต้องมี Library ซึ่งเราจำเป็นต้องรู้จักและใช้ Library ให้เป็นเพื่อช่วยในการเขียนโปรแกรมให้งายขึ้น 
          สำหรับภาษา C นั้น Library ที่เป็นพื้นฐานก็คือ stdio.h ซึ่งเวลาทีเราจะใช้ Library ต้องพิมพ์  #include <ชื่อ Library>
         ทุกครั้งที่เขียนโปรแกรมในภาษา C จะต้องมี ฟังก์ชัน main ซึ่ง เป็นฟังก์ชันหลัก ในส่วนข้างหน้าของทุกๆฟังก์ชันจะต้องระบุ data type เสมอ
             void คือ data type ที่ไม่ต้องมีการคืนค่าของฟังก์
          int char float คือ data type ที่ต้องมีการคืนค่าของฟังก์ชัน
       
         ตัวอย่างที่ 1 
 #include <stdio.h>
void main(){
       printf("Hello World"); //printf มาจาก Library stdio.h
}
            ผลัพธ์ของโปรแกรมที่ 1
Hello World //จะแสดงคำว่า Hello World ออกมาทางหน้าจอ

    
        ตัวอย่างที่ 2
 #include <stdio.h>
int main(){
       printf("Hello World"); //printf มาจาก Library stdio.h
       return 0;//การคืนค่าของฟังก์ชัน
}
            ผลัพธ์ของโปรแกรม2
Hello World //จะแสดงคำว่า Hello World ออกมาทางหน้าจอซึ่งเหมือนกับโปรแกรมที่1

วันพฤหัสบดีที่ 9 มกราคม พ.ศ. 2557

Intro to C

         To start  programming The most important Syntax of the language, each program will have different Syntax away. And it have a Library,we need to know and use the Library to make it easier.
           For C, the Library at the base is stdio.h which time we will use the Library to type # include <Name Library>.
         Every time you write a program in C to be the main function.  In front function must has datatype.
       void  data type be does not have a return  function.
       int,cha,float data type be return a value function

Example 1
  # include <stdio.h>
void main () {
        printf ("Hello World"); / / printf function from Library stdio.h.
}
Output 1
Hello World / / show "Hello World " on the screen..

Example 2
  # include <stdio.h>
int main () {
        printf ("Hello World"); / / printf function from Library stdio.h.
        return 0 ;/ / the return value of the function.
}
Output 2
Hello World / / show "Hello World " on the screen same Ex1.