Skip to main content

Identifiers and keywords in C



In this section, we will learn about the keywords and reversed words in C programming that are part of the syntax. also, we will learn about the identifiers and how to name them.

Keywords

int, double, struct, switch, etc.

Identifiers

test, count, high, high-speed, etc.

now we will study identifiers and keywords in detail. we will see, how many keywords are there in C programming and all the rule for the select identifiers.

Keywords in C

Keywords are predefined, reversed words used in programming that have special meanings to the compiler. Each keyword is meant to perform a specific function in a C program. Since keywords are referred names for the compiler, they can not be used as variable names.

There are a fixed number of Keyword in the C programming language and every Keyword serve as a building block for program statements. 

There is a total of 32 keywords in C keywords written in lowercase letters.

The following table represents the keywords in C. Here is a list of some identifiers given below

 


Identifiers in C

Each program element in a C program is given a name called an identifier. Names given to identity variables, functions, and arrays are examples of identifiers. 

identifiers must be unique. they are created to give a unique name to an entity to identify it during the execution of the program.

for example

 1 int square
 2 double balance 
 3 function add()

Here, square, balance, and add() are identifiers. there is one thing that you should remember, identifier names must be different from keywords. you cannot use it as an identifier because it is a keyword.

 

The rule for an identifier

  • An identifier can only have alphanumeric characters (a-z, A-Z, 0-9) and an underscore (_).
  • The first character of an identifier can also contain the alphabet (a-z, A-Z).
  • Identifiers are also case-sensitive in C. For example, name and Name are two different identifiers in C.
  • Keywords are not allowed to be used as identifiers.
  • No special character, such as semicolons, periods, white spaces, slash, or commas are permitted to be used in or as identifiers



Comments

Popular posts from this blog

Variables in C

  Variables in C   Variables in programming In computer terms, a variable is the name of the memory location of the data which can be accessed with the help of that name and can be rewritten or used for calculations later on. Variable is a storage area. which is used to store the data. variable data is contained, which can be changed at any time during program execution. After declaring the variable it is given a value, this value is to be assigned in many forms. Like x = 5; or a=10;    Before using the variable it is necessary to declare in C. Values of variables are changeable. You can delete a value and enter another value.  You can also do this on compile time and dynamically(during program execution). For example:  Let’s say we have to store a student’s name and his roll number in a variable. For this, we take two variables, store the name of the student in a variable while the other variable stores the roll number ...

Pow() function in C

  What is Pow() function in C? C Programming Language has many pre-defined library functions stored in various different header files. pow() function is one such pre-defined library function stored in the header file. pow() function in C language is used to find out the power of a number i.e; it is used to calculate ” XY ” in C programming     How does the pow() function work? As discussed above pow() function in C is used to determine the power of an exponent. We can use pow() in our code after including the header file. pow() function in C is denoted as  pow(x,y)  hence, it accepts two values. x is the exponent value and y is the power value Syntax of pow() function in C pow(exponent, power) Both exponent and power can be any real number, pow() function work with all types of data types except char, string, and Boolean. Let's take an example and understand how to use the pow() function in C code. There are many other library functions...