Comments တွေက code ကို ဖတ်တဲ့လူနားလည်အောင် မှတ်ချက်ရေးတဲ့နေရာပါ။ Compiler က comments ကို run မလုပ်ပါ။ အရေးကြီး logic, formula, warning တွေကို မှတ်သားဖို့ကောင်းပေမယ့် code တစ်ကြောင်းတိုင်းကို comment ရေးဖို့တော့ မလိုပါ။
c
#include <stdio.h>
int main() {
// Print a welcome message
printf("Welcome to C!
");
/* This block can be used
for longer notes. */
printf("Comments make code easier to read.");
return 0;
}// က single-line comment ဖြစ်ပြီး /* ... */ က multiple lines comment ပါ။ Program output ထဲမှာ comment တွေ မပေါ်ပါ။
You should see
Welcome to C! Comments make code easier to read.Info
Comment က code ရဲ့ “ဘာကြောင့်” ကိုရှင်းပေးသင့်ပါတယ်။ Code က obvious ဖြစ်နေတဲ့အရာကို ထပ်ပြောရုံ comment မရေးတာ ပိုသန့်ပါတယ်။