0% found this document useful (0 votes)
2 views2 pages

C Programming Identifiers and Constants

The document outlines the rules for naming identifiers in programming, stating that they cannot be keywords, must not contain spaces, and can only include letters, digits, and underscores. It also defines constants as unchanging identifiers typically declared with the '#define' directive, and explains strings as collections of characters used in output statements or as character arrays. Additionally, it introduces special characters or escape sequences that affect output but are not displayed, starting with a backslash.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

C Programming Identifiers and Constants

The document outlines the rules for naming identifiers in programming, stating that they cannot be keywords, must not contain spaces, and can only include letters, digits, and underscores. It also defines constants as unchanging identifiers typically declared with the '#define' directive, and explains strings as collections of characters used in output statements or as character arrays. Additionally, it introduces special characters or escape sequences that affect output but are not displayed, starting with a backslash.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Identifiers

It is a name given to a variable, function, structure, array, pointers or any object


of a program.

Rules for naming identifiers

i. It should not be a keyword.


ii. It should not contain a space.
iii. Only alphabet, digits and underscore ( _ ) symbol is allowed for naming.
iv. First character must be alphabet or an underscore.
v. It can contain both uppercase and lowercase characters.

Constants

These are the identifiers whose value remains unchanged in the entire
program. Generally it is declared as a symbolic constant using “#define “
pre-processor directive ahead of main() function.

Eg: #define PI 3.14;

#define g 9.8;

Strings

A collection of characters is called string. String in a C program can be used in


two different ways.

i. As a message or output statement to the user using


printf(“ control string”);
ii. As a data type in the form of character array.
Eg: char name[30];
Special characters or symbols

They are also called escape sequence because they are not displayed but their
effect is seen in an output. They begin with “\” backslash [Link]:

Escape Sequence Meaning


\a Audible alert
\n New line
\t Horizontal tab
\v Vertical tab

You might also like