The Code Fix

🇨 شرح لغة C

الشروط والحلقات

الشروط

int age = 18;

if (age >= 18) {
    printf("بالغ\n");
} else {
    printf("قاصر\n");
}

switch

int day = 3;
switch (day) {
    case 1: printf("الأحد"); break;
    case 2: printf("الاثنين"); break;
    default: printf("يوم آخر");
}

حلقة for

for (int i = 1; i <= 5; i++) {
    printf("%d ", i);
}

حلقة while

int count = 1;
while (count <= 3) {
    printf("%d", count);
    count++;
}

المصفوفات

int numbers[3] = {10, 20, 30};

for (int i = 0; i < 3; i++) {
    printf("%d ", numbers[i]);
}

النصوص (مصفوفات char)

char name[] = "براء";
printf("%s\n", name);

النص في C مصفوفة أحرف تنتهي بحرف فارغ \0 تلقائيًا.

🎯 التالي: الدوال والمؤشّرات.