Education, technology and philosophy

C Programming

C គឺជាភាសាមូលដ្ឋានគ្រឹះ ឬhigh-level language ដែលត្រូវបានបង្កើតឡើងដោយលោក Dennis M. Ritchieនៅក្នុងឆ្នាំ១៩៧០ ។ វាត្រូវបានបង្កើតឡើងដើម្បីសរសេរធ្វើជាOperating system ដែលហៅថាUNIX ហើយម្យ៉ាងវិញទៀតវាបានចាប់ផ្តើមប្រកាស់អោយប្រើប្រាស់ជាផ្លូវការនៅក្នុងឆ្នាំ១៩៨៨ ដោយAmerican National Standard Institute(ANSI)។
Program structure
C Program គឺជាមូលដ្ឋានគ្រឹះដែលរួមបញ្ចូលទៅលើគ្រប់ផ្នែកទាំងអស់
➤Preprocessor commands
       ➥Functions
      ➥Variables
      ➥Statements and Expressions
      ➥Comments
➢  យើងទៅមើលឧទាហរណ៍ខាងក្រោម
        #include <stdio.h>
        int main()
         {
          /* my first program in C */
          printf("Hello, World! \n");
          return 0;
        }
⇝ការពន្យល់ពីកូដ៖
1.    ជួរទី១ នៃprogram #include <stdio.h>គឺជាPreprocessor command ដែលប្រាប់ទៅC compiler អោយចាប់យក stdio.h file មុនពេលធ្វើការcompile code
2.    ជួរបន្ទាប់ Int main() គឺជាMain Function ដែលកម្មវិធីចាប់ផ្តើមដំណើរការ។
3.    ជួរបន្ទាប់ទៀត/*…*/គឺប្រើសមា្រប់សរសេរចំណាំនៅលើកូដរបស់ដើម្បីកុំអោយភ្លេច។
4.    ជួរបន្ទាប់គឺPrintf(…)គឺជាfunction ផ្សេងមួយទៀត ដើម្បីបង្ហាញលទ្ធផលនៅលើscreen ដើម្បីអោយUser មើលឃើញពាក្យថា”Hello, World!”។
5.    ជួរចុងក្រោយreturn 0; គឺជាបញ្ចប់នៃmain() function និងReturn តម្លៃស្មើ០។
ចំណាំ៖ ដើម្បីដំណើរការកូដនេះបានគឺយើងត្រូវមានText editor ដើម្បីស រសេរកូដ។ទាញយកកម្មវិធីសម្រាប់សរសេរកូដ​ Dev CPP Download។រក្សារទុកដោយប្រើប្រាស់កន្ទុយចុងក្រោយ.c។ 

0 comments:

Post a Comment

Follow

Ads Here

Advertise here

Recent Posts

Unordered List

Pages

Theme Support