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

Get Started

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

C code ကို run လုပ်ဖို့ compiler လိုပါတယ်။ Compiler ဆိုတာ သင်ရေးထားတဲ့ .c file ကို computer နားလည်နိုင်တဲ့ executable program အဖြစ်ပြောင်းပေးတဲ့ tool ပါ။ စတင်လေ့လာနေတဲ့အချိန်မှာ online editor သုံးလို့ရပြီး project တကယ်လုပ်ချင်လာရင် local computer မှာ GCC သို့မဟုတ် Clang ကို setup လုပ်တာက ပိုကောင်းပါတယ်။

c
// hello.c
#include <stdio.h>

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

#include <stdio.h> က printf() သုံးနိုင်ဖို့ library ထည့်တာပါ။ main() က program စတင် run မယ့်နေရာဖြစ်ပြီး return 0; က program အောင်မြင်စွာပြီးဆုံးကြောင်း operating system ကိုပြန်ပြောတာပါ။

You should see
Hello C learner!

Info

File name ကို hello.c လို .c extension နဲ့ သိမ်းပါ။ Terminal မှာ gcc hello.c -o hello လို့ compile လုပ်ပြီး ./hello နဲ့ run နိုင်ပါတယ်။

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

  • Compiler မရှိသေးဘဲ terminal မှာ gcc ရိုက်လိုက်ရင် command not found ဖြစ်နိုင်ပါတယ်။ အဲဒါဆို compiler setup အရင်လုပ်ပါ သို့မဟုတ် Code စရေးမယ် button ကနေ online editor ကိုသုံးပါ။
Get Started | Thuta Learning