C++ Identifikator

islomali99

islomAli99

Posted on February 22, 2023

C++ Identifikator

Assalamu aleykum, C++ dasturlash tilida o'zgaruvchilar alohida kalit so'zlar bilan nomlanadi.
Misol uchun: ism, num, yosh, cpp, kabi noyob nomlar Identifikator hisoblanadi.Identifikator qisqa nomlar (x va y kabi) yoki ko'proq tavsiflovchi nomlar bo'lishi mumkin (yosh, cpp, age name, day, month).

Dasturchi tomonidan o'zgaruvchi, o'zgarmas, funksiyalar uchun beriladigon extiyoriy nom bu Identifikator deyildai.

Izoh: C++ dasturlash tilida Identifikatorni yaratishda tavsiflovchi nomdan foydalanish tafsiya etaman.
Misol uchun:

int age = 24;
string name = "Ilmhub IT school";
Enter fullscreen mode Exit fullscreen mode

C++ dasturlash tilida Identifikator misol keltiraman.

#include <iostream>
using namespace std;

int main()
{

int age = 24;
string name = "I am learning C# at the moment";
string country = "Uzbekistan";

cout << name << endl;
cout << country;

return 0;
}
Enter fullscreen mode Exit fullscreen mode

Identifikator tanlanganda quyidagilarga ahamiyat berish kerak:

  • Identifikator lotin harflaridan boshlanishi shart;
  • Ikkinchi simvoldan boshlab raqamlardan foydalanish mumkin;
  • C++ da katta kichik harflar farq qiladi. Ya'ni quyidagilarning har biri alohida identifikator hisoblanadi: KATTA, katta, KaTTa, kAttA, KattA..;
  • Probel C++ da so'zlarni ajratish uchun ishlatiladi. Shuning uchun identifikatorda probeldan foydalanib bo'lmaydi.
  • Data type ladan (int, float, for, while kabi) so'zlardan indentifikator sifatida foydalanib bo'lmaydi;

Eslatma: Identifikator tanlashda birinchi belgi sifatida << _ >> belgisidan foydalanmaslik tavsiya etiladi.

💖 💪 🙅 🚩
islomali99
islomAli99

Posted on February 22, 2023

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

while, do-while and for loops in C++
beginners while, do-while and for loops in C++

March 7, 2024

If statements in C++
beginners If statements in C++

March 4, 2024

Operators and true folse .
beginners Operators and true folse .

March 14, 2023