Agar siz C tilini bilsangiz, Java, Python, C++, C# va boshqalar kabi mashhur dasturlash tillarini o'rganishda muammo bo'lmaydi, chunki sintaksis o'xshash
Git cheat sheet:
git clone — At the beginning of work.
git commit — After making changes. Remember to add a clear name for the commit.
git push origin — To save changes to a remote server.
git status — The current state of the repository.
Do not push object files or executable files to the repository! Never!
Always work in branches. Use the develop branch to do all your work.
git clone — At the beginning of work.
git commit — After making changes. Remember to add a clear name for the commit.
git push origin — To save changes to a remote server.
git status — The current state of the repository.
Do not push object files or executable files to the repository! Never!
Always work in branches. Use the develop branch to do all your work.
C Variables
Variables are containers for storing data values, like numbers and characters.
In C, there are different types of variables (defined with different keywords), for example:
int - stores integers (whole numbers), without decimals, such as 123 or -123
float - stores floating point numbers, with decimals, such as 19.99 or -19.99
char - stores single characters, such as 'a' or 'B'. Characters are surrounded by single quotes
Variables are containers for storing data values, like numbers and characters.
In C, there are different types of variables (defined with different keywords), for example:
int - stores integers (whole numbers), without decimals, such as 123 or -123
float - stores floating point numbers, with decimals, such as 19.99 or -19.99
char - stores single characters, such as 'a' or 'B'. Characters are surrounded by single quotes
int main() {
int age = 12;
int born = 23;
int birth = age + born;
printf( "%d", birth);
return 0;
}int main() {
int birthYear = 2007;
int currentYear = 2025;
int age = currentYear - birthYear;
printf("Sizning yoshingiz: %d\n", age);
return 0;
}int main() {
int firstNumber = 33;
printf("firstNumber = %d", firstNumber);
return 0;
}int myNum = 15; // Integer (whole numbe
r)
float myFloatNum = 5.99; // Floating point number
char myLetter = 'D'; // Character
// Print variables
printf("%d\n", myNum);
printf("%f\n", myFloatNum);
printf("%c\n", myLetter);int main() {
int number1 = 33;
printf("%d\n", number1);
printf("%d", number1);
return 0;
}
coding with ☕️
int main() { int number1 = 33; printf("%d\n", number1); printf("%d", number1); return 0; }
difference between this
printf("%d\n", number1);
and this printf("%d", number1);int- 123 yoki -123 kabi o'nliksiz butun sonlarni (butun sonlarni) saqlaydifloat - 19,99 yoki -19,99 kabi o'nlikli suzuvchi nuqtali raqamlarni saqlaydichar - "a" yoki "B" kabi bitta belgilarni saqlaydi. Belgilar bitta tirnoq bilan o'ralganAgar siz mavjud o'zgaruvchiga yangi qiymat tayinlasangiz, u avvalgi qiymatni qayta yozadi :
Misol
Misol
int myNum = 15; // myNum is 15myNum = 10; // Now myNum is 10Bundan tashqari, bir o'zgaruvchining qiymatini boshqasiga belgilashingiz mumkin:
Misol
Misol
int myNum = 15;int myOtherNum = 23;// Assign the value of myOtherNum (23) to myNummyNum = myOtherNum;// myNum is now 23, instead of 15printf("%d", myNum);Bir nechta o'zgaruvchilarni e'lon qilish
Bir xil turdagi bir nechta o'zgaruvchilarni e'lon qilish uchun vergul bilan ajratilgan ro'yxatdan foydalaning:
Misol
Bir xil turdagi bir nechta o'zgaruvchilarni e'lon qilish uchun vergul bilan ajratilgan ro'yxatdan foydalaning:
Misol
int x = 5, y = 6, z = 50;printf("%d", x + y + z);int main() {
int x, y, z;
x = y = z = 50;
printf("%d", x + y + z);
return 0;
}
Siz bir xil turdagi bir nechta o'zgaruvchilarga bir xil qiymatni belgilashingiz mumkin: