DEV Community

Cover image for C++ Identifikator
islomAli99
islomAli99

Posted on

5

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.

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (2)

Collapse
 
zafar7709 profile image
zafar7709

Zor

Collapse
 
jony11111 profile image
jony11111

zur yordam berdi manhga

The Most Contextual AI Development Assistant

Pieces.app image

Our centralized storage agent works on-device, unifying various developer tools to proactively capture and enrich useful materials, streamline collaboration, and solve complex problems through a contextual understanding of your unique workflow.

👥 Ideal for solo developers, teams, and cross-company projects

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay