Identifiers
Identifier विभिन्न elements जैसे arrays, functions, variables, structure, unions, pointers आदि को refers करता है। यह एक user-defined शब्द है। यह alphanumeric characters का combination है जिसे lowercase या uppercase दोनों में लिखा जा सकता है।
Identifiers का represent करने के लिए 53 characters हैं। वे 52 alphabetic characters (uppercase and lowercase अक्षर दोनों) और underscore character हैं। underscore character को identifiers में एक letter माना जाता है। underscore character का इस्तेमाल आमतौर पर identifier के बीच में किया जाता है। 63 alphanumeric characters हैं यानी 53 alphabetic characters और 10 digits(0-9).
Example of identifiers :
Valid :
hello_world
pay12
_abc
Defined :
pay_bill_my_address
Invalid:
while - reserverd word and it cannot be used as a user defined
pay bil - Blank space are not allowed
KeyWords :
कुछ शब्द C द्वारा specific purposes के लिए reserved हैं और identifier के रूप में उपयोग नहीं किए जा सकते हैं क्योंकि नए words को कंप्यूटर द्वारा assign करने की अनुमति है। इन्हें Reserved Words or Keywords कहा जाता है। सभी keyword का अर्थ निश्चित होता है इसलिए उनका अर्थ (meaning ) नहीं बदला जा सकता है। वे program statements के लिए basic building blocks हैं।
c में basic 32 Keywords मौजूद हैं।
Rules and Best Practices for Creating Identifiers
Identifiers are names given to various program elements like variables, arrays, functions. union, structures, pointers, etc
Rules for Writing Identifiers :
- एक valid identifier एक या अधिक अक्षरों, अंकों या underscore characters ( _ ) का एक क्रम (sequence) होता है। न तो रिक्त स्थान (space) और न ही विराम चिह्न (punctuation marks ) या प्रतीक (symbols) किसी identifier का हिस्सा हो सकते हैं। केवल अक्षर अंक और एकल अंडरस्कोर वर्ण (letters digits and single underscore characters) मान्य हैं।
- इसके अलावा, variable identifiers को हमेशा एक अक्षर(letter) से शुरू करना होता है। वे एक underline character (_) से भी शुरू हो सकते हैं, लेकिन कुछ cases में ये compiler specific keywords या external identifiers के साथ-साथ कहीं भी दो लगातार underscore characters वाले identifiers के लिए आरक्षित (reserved) हो सकते हैं। किसी भी स्थिति में वे एक अंक ( digit) से शुरू नहीं कर सकते हैं।
- अपने स्वयं (own) के identifiers का inventing करते समय चेक करे कि वे C language के किसी भी keywords से मेल (match) नहीं खा रहे हैं और न ही आपके compiler's के विशिष्ट (specific) keywords, जो आरक्षित कीवर्ड (reserved keywords) हैं, उनसे मेल खा रहे हो।
Example of Identifiers :
Valid :
var_abc _345
max_no no121_ABC
Invalid:
121noMax-no var float
121 ab$ 345_ #ab
Best Practices for Creating Identifiers :
C language "case sensitive" language है (चूंकि upper and lower case letters को अलग तरह से व्यवहार(treat) किया जाता है) इसका मतलब है कि बड़े अक्षरों (capital letters) में लिखा गया एक identifier उसी नाम के साथ दूसरे के बराबर नहीं है जो छोटे अक्षरों में लिखा गया है।
Programmer जो चाहें identifier का नाम चुन सकते हैं। हालांकि, यदि Programmer, identifier के लिए meaningful Name चुनते हैं, तो इसे समझना और काम करना आसान होगा, खासकर बड़े program के मामले (case) में।
उदाहरण के लिए, निम्न identifiers को अलग-अलग माना जाएगा क्योंकि lower and upper case letters का अलग-अलग उपयोग किया जाता है।
MAX
max
Max
ये तीन अलग-अलग identifiers हैं
Conclusion :
इसलिए, variables and functions के नाम के लिए lower or mixed case letters का उपयोग करना और symbolic constants के नाम के लिए upper case का उपयोग करना एक general practice है।
And Check Introduction of Computer (Part 1)
And Check Computer Generations - History of Computers (Part 2)
And Check Why do we need to write #include<stdio.h>
And Check Program Compilation Process
And Check Explanation of main() function using Sample Program
And Check What is C Language
And Check Introduction of Computer (Part 1)
And Check Computer Generations - History of Computers (Part 2)
And Check Why do we need to write #include<stdio.h>
And Check Program Compilation Process
And Check Explanation of main() function using Sample Program
And Check What is C Language


0 Comments