Thuta Learning
ရှာဖွေရန်
BasicProgrammingbeginner

Syntax

စိတ်လျှော့ပါ။ ဒီခန်းကို စာအုပ်လိုမဟုတ်ဘဲ စကားပြောသလိုပဲ၊ နားလည်လွယ်အောင် ရှင်းပါမယ်။

C program တစ်ခုရဲ့ အခြေခံပုံစံက header file ထည့်ခြင်း၊ main() function ရေးခြင်း၊ statement များကို semicolon နဲ့အဆုံးသတ်ခြင်းတို့ပါ။ C က grammar တင်းတဲ့ language ဖြစ်လို့ bracket, semicolon, quote များကို အလွန်သတိထားရပါတယ်။

c
#include <stdio.h>

int main() {
  printf("Hello World!");
  return 0;
}

#include က library ခေါ်တာ၊ int main() က program ရဲ့ main function၊ { } က code block၊ printf() က output ထုတ်တာ၊ ; က statement တစ်ကြောင်းပြီးဆုံးကြောင်း compiler ကိုပြောတာပါ။

You should see
Hello World!

Info

printf("Hello World!") ထဲက text ကို double quotes နဲ့ရေးရပါတယ်။ Character တစ်လုံးဆို single quote သုံးပြီး string/text ဆို double quote သုံးပါတယ်။

ဒီနေရာမှာ လူအများမှားတတ်တယ်

  • Semicolon မေ့တာ၊ quote မပိတ်တာ၊ closing brace } မထည့်တာတွေက စတင်သူတွေမှာ အတွေ့များဆုံး error တွေပါ။
Syntax | Thuta Learning