In this tutorial, you will learn about keywords and identifiers in C programming that are part of the syntax. Also, you will learn about identifiers and the proper way to name a variable. Keywords and identifiers in C programming play an important role in Coding in c.
C Keywords and Identifiers
In C language identifiers are the names given to variables, constants, functions, and user-defined data. These identifiers are defined against a set of rules.
Example
int marks;
char studentName[30];
Here, marks and student names are identifiers.
Keywords are specifically reserved, predefined words in C each of which has a specific feature associated with it. Almost all of the words which help us use the functionality of the C language are included in the list of keywords. So you can imagine that the list of keywords is not going to be a small one!
There are a total of 32 keywords in C these are given below in the table
auto |
double |
int |
struct |
break |
else |
long |
switch |
case |
enum |
register |
typedef |
char |
extern |
return |
union |
continue |
for |
signed |
void |
do |
if |
static |
while |
default |
goto |
sizeof |
volatile |
const |
float |
short |
unsigned |
if, else, switch, case, default – Used for decision control programming structure.
break – Used with any loop OR switch case.
int, float, char, double, long – These are the data types used during variable declaration.
for, while do – types of loop structures in C.
void – One of the return types.
goto – Used for redirecting the flow of execution.
auto, signed, const, extern, register, unsigned – defines a variable.
return – This keyword is used for returning a value.
continue – It is generally used with for, while, and do-while loops, when the compiler encounters this statement it performs the next iteration of the loop, skipping the rest of the statements of the current iteration.
enum – Set of constants.
size of – It is used to know the size.
struct, typedef – Both of these keywords are used in structures (Grouping of data types in a single record).
union – It is a collection of variables, which shares the same memory location and memory storage
In this tutorial, you will learn about keywords and identifiers in C programming that are part of the syntax. Also, you will learn about identifiers and the proper way to name a variable.