C token is the smallest independent unit of a program.
C is a superset of C, so most C constructs are legal in C and their meaning and usage remain unchanged. Therefore, tokens, expressions, and data types are similar to C tokens, expressions, and data types.
The following are C tags: (Most C tags are basically similar to C tags)
Keywords are reserved words with a fixed meaning and their meaning cannot be changed. The compiler already knows what these keywords mean and how they work. C has more keywords than C, and these extra keywords do special jobs.
There are 32 of them, here are them
auto const double float int short struct unsigned break continue elseforlong signed switch void case default enumgoto register sizeof typedef volatile char do extern if return static unionwhile
There are another 30 reserved words that are not in C and therefore are new to C, Here they are -
asm dynamic_cast namespace reinterpret_cast try bool explicit new static_cast typeid catch false operator template typename class friend privatethis using const_cast inline public throw virtual delete mutable protected true wchar_t
Identifiers are names given to different items such as variables, structures, and functions. Furthermore, identifier names must be unique as these entities are used in the execution of the program.
Identifier Naming Convention
Only alphabetic characters, numbers, and underscores are allowed.
The first letter must be a letter or an underscore (_).
Identifiers are case-sensitive.
Reserved keywords cannot be used as names for identifiers.
There are two other different ways to define constants in C. They are:
By using the const keyword
By using the #define preprocessor
Constant declaration:
const [data_type] [constant_name]=[value];
A variable is a meaningful name for a location in computer memory where data is stored. When you use a variable, you refer to the computer's memory address.
Syntax for declaring variables
[data_type] [variable_name];
#includeint main() { int a,b;// a and b are integer variable cout<<" Enter first number :"; cin>>a; cout<<" Enter the second number:"; cin>>b; int sum; sum=a+b; cout<<" Sum is : "< Copy after login
C operators are used to perform mathematical or logical operations symbol.
Operator | Description | tr>
---|---|
Addition | |
- | Subtraction |
Multiplication | |
Division | |
Modulo |
Description | |
---|---|
increment | |
Decreasing |
!= | |
> | |
>= | |
#|| |
|
! |
|
Bitwise Operator |
!= | |||||||||||||||||||||||||||||||||||||
>> | |||||||||||||||||||||||||||||||||||||
~ | |||||||||||||||||||||||||||||||||||||
& | |||||||||||||||||||||||||||||||||||||
^ | |||||||||||||||||||||||||||||||||||||
| | |||||||||||||||||||||||||||||||||||||
Assignment Operator
Miscellaneous operators
|
The above is the detailed content of C/C++ markup?. For more information, please follow other related articles on the PHP Chinese website!