17 Oct Tokens in C Programming
C Tokens are the individual words and punctuation, which is the smallest element of a program, understandable by the compiler. In easier language, C tokens are individual units in a program. In this lesson, we will learn about Tokens in C Programming.
Identifiers
Identifiers in C language are used for naming variables, functions, and arrays. Do not use keywords as identifiers.
You cannot use keywords as identifiers; they are reserved for special use.
Here are some examples of valid identifiers,
1 2 3 4 5 6 7 8 |
marks _marks a myVal study987 val1 |
To name C Identifiers, follow these rules:
- The identifier must begin with a letter or underscore (_).
- C identifiers must consist of only letters, digits, or underscore.
- Do not add any special characters to the identifiers.
- Should not be a keyword.
- It should not contain any white space.
Keywords
Keywords are reserved words used in programming languages. The compiler already knows these names, so you cannot use them as variable names,
Total of 32 keywords are part of C language, which are known to the C compiler.
Here is a list,
Whitespace
White space in C language includes vertical tab, horizontal tab, blank, comments, form feed, end-of-line, etc. A line with whitespace isn’t considered by the compiler. You can add a comment there itself as shown below,
1 2 3 4 |
// displaying value printf(“Value = %d”,a); |
Use whitespace to separate parts of statements, for example,
1 2 3 |
float points; |
If you liked the tutorial, spread the word and share the link and our website Studyopedia with others:
For Videos, Join Our YouTube Channel: Join Now
Read More:
No Comments