Keyword,Literal,Indentifier

Literal in C/C++

What is literal ?
Literal is character constant.Literals are the Constant values that are assigned to the constant variables.It is a fixed value that can't be modified.Character literal is used to store a single character within a single quote.

Keyword in C/C++

What is keyword ?
Keywords are predefined reserved word in programming. They cannot be used as an identifier.
Example :-int, float, long, char, void, if, for

Indentifier in C/C++

What is Indentifier ?
Identifers are the names we supply for variables, types, functions, and labels in our program. They are program supplied word except keyword.We cannot use the keywords as an identifier.

Rules of defining an Identifier

Rules:-

  1. It can be upper case (A to Z).
  2. It can be lower case (a to z).
  3. It can be digit (0-9).
  4. We can also use underscore(_).
  5. Note:-It should not start with number or digit.But we can start indentifier with upper case, lower case, underscore(_).

Example:-

  • int student ,int _abc ,int x, int student1: here student, _abc, x , student1 is valid indentifier.
  • int 8student : here 8student is invalid because indentifier cannot be start with digit.

Header file

Header file have a '. h' an extension.

stdio.h conio.h
printf();scanf(); clrscr(); getch();

First program in c

File extension of c program is '.c' and file extension of c++ program is '.cpp' .

Here printf()-is used to print the value which is under the double quote.
clrscr()- is used to clear the screen.
getch()- is used to hold the screen.
void main() - It is the main function and void main() function does not return any value.
Console Window -It is the screen where we see output of the program.
stdio.h -It is a header file that contain printf() function.
conio.h -It is also a header file that contain clrscr(),getch() function.
\n - It is used to change the line. \\ -It is used for single line comment. Comment is not visible on the console window. \* *\ It is used for multiple line comment. Note:- /* This/* is nested */ comment. */ -Nested comment is not allowed.

Output