Constants, Identifiers, Variables, Keywords, & Delimiters In C Language

Constants, Identifiers, Variables, Keywords, & Delimiters In C Language

    Hi guys, in this section we will discuss some basic terminology of C programming language. Here we discuss what is "Constant", "Identifier", "Variable" and many more. So let's get started.

Constant:

  • Constants is an entity that has values that can not be changed further. These fixed values are also known as Literals.
  • Constants can be of any of the basic data types like an integer constant, a floating point constant, a character constant, or a string literal.
  • Constants are many types according to data types such as follows:
    • Integer Constants: 1,3,7,89,100...etc.
    • Real Constants: 2.3,5.8,7.0...etc.
    • Character Constants: 'a', 'b', '@'...etc.
    • String Constants: "Hello", "Ram", "Sunil", "DoWithMe"...etc.

Identifiers:

  • Identifiers are the names given to variables, constants, functions, and user-defined data types. Examples: int length=10;
  • Identifiers must be unique in a particular program.
  • We can uniquely identify any entity and other variables with the help of identifiers.         Examples: int length; float area;  etc.

Variables:

  • A variable is a container that stores a value in the memory location, which can be used during the time of execution of the program.
  • To indicate the storage area, each variable should've given a unique name i.e. called an identifier.
  • Examples: int a = 3;   (here a is a variable which stores an integer value)
  • The value of a variable can be changed, hence the name variable is justified.
    • For Example:
      • int length = 10;
      • int length = 30;
Rules for naming variables in C Language:
  1. The first character must be an alphabet or underscore.
  2. No commas, blank-space allowed.
  3. No special symbol is allowed.
  4. Variables names are case sensitive.
  5. For better readability make meaningful variables names.
  • For example:
    • int num=10;
    • float area=30.2; etc.

Keywords:

  •  Keywords are pre-defined reserved words used in programming that have special meanings to the compiler.
  • About 32 keywords in C language.
  • Keywords are basically written in lowercase letters.
  • Keywords can't be used as an identifier.
  • For example:
    • int num = 10;  (here int is the keyword and a is a variable)


C Language Keyword Table Picture

Delimiters:

  • Delimiters are also known as separators or punctuators.
  • They are the characters or symbols that we mainly used to separate values.
  • For Examples,
    • Comma(,)
    • Semicolon(;)
    • Colon(:)
    • Braces ( {},(),[] )
    • Quotes("",' ') ...etc.

That's all for this section, you can also watch videos for more information about this concept.

Watch On YouTube😎




Post a Comment