Chap. 1 : Unit 4 : Introduction to C Language: Part 7

“नावात काय आहे”wink असं जरी जगप्रसिद्ध कवी आणी नाटककार म्हणाला असला तरी जसे प्रत्येक व्यक्तीचे जन्मा नंतर नाव ठेवावेच लागते तसेच प्रोग्रॅमिंग मध्ये व्हेअरेबल्स, फंक्शन्स इत्यादीचे काहीतरी नाव असावे लागते…enlightenedज्या नावानेच ते ओळखले जाते व नंतरच ऑपरेटींग सिस्टीम त्यांना मेमरी मध्ये आश्रय देतेsmiley. त्यामूळे एखाद्याचे नाव ठेवतांना जर आपण जितका आटा-पिटा करतो तितका आटापिटा प्रोफेशनल प्रोग्रॅमिंग मध्ये व्हेअरेबल्सची नावे ठेवतांना सुद्धा करावा लागतो.. विश्वास बसत नाही ना…?surprise

Now let’s try to understand what the keywords and variables are and which rules need to be followed to construct variable.

Keywords

Keywords are words that are specially reserved by language developers for their own use. Each language has its own set of keywords. What I mean by reserved word is that…. none of these can be used for declaration of variable. That’s all.

C language has in all 32 keywords. If…else…break…continue….default….are some of the examples of keywords.

You don’t have to learn them by heart…so as we go along and solve the programs…you will be familiar with all of them.

As said before only thing you should remember is…the keyword should not be used for variable declaration otherwise you may end up getting compile time error while writing programs. For example int float cannot be name of the variable…because float is the keyword in C and you cannot have variable of the same name as that of keyword.

Variable in C

Variable is the entity whose contents can be changed during execution of the program. In C variable is a named memory location. Whenever variable is declared in C program, appropriate bytes are reserved depending upon data type. It is very important to give meaningful name to the variable…and it should be small and sweet…

Generally following rules should be followed while naming the variable….

  • The name of the variable should not start with digit. For example 24num is not valid variable name.
  • Variable name cannot contain blank space.
  • Variable name cannot contain any special character except underscore. For example sal@company is not valid variable name
  • Variable name length must not exceed 32. However long names should be avoided and it should be limited to 8 to 12 characters
  • All variables in C have to be declared at the beginning of a block….say function block of block of the loop…

Access this framework with lot more stuff like C language MCQ, viva and interview preparation, Glossary, Solved Programs of C language etc. please register for Discount Coupon

 

cenglishcppengcmarathi

Leave a Reply

%d bloggers like this: