Sie sind auf Seite 1von 6

Array - An array is collection of items stored at continuous memory locations.

The idea is to declare


multiple items of same type together.
An array is a collection of data items, all of the same type, accessed using a common name. A one-
dimensional array is like a list; A two dimensional array is like a table; The C language places no
limits on the number of dimensions in an array, though specific implementations may.

Array of pointers - Just like we can declare an array of int, float or char etc, we can also declare an
array of pointers, here is the syntax to do the same.
Syntax: datatype *array_name[size];

Assignment Operator - Assignment Operator is Used to assign value to an variable.


1. Assignment Operator is denoted by equal to sign
2. Assignment Operator is binary operator which operates on two operands.
3. Assignment Operator have Two Values – L-Value and R-Value.Operator copies R-Value into L-
Value.
4. Assignment Operator have lower precedence than all available operators but has higher
precedence than comma Operator.

Datatype - In the C programming language, data types are declarations for memory locations or
variables that determine the characteristics of the data that may be stored and the methods
(operations) of processing that are permitted involving them.

Constant - Constants refers to the fixed values that do not change during the execution of a program.
A "constant" is a number, character, or character string that can be used as a value in a program.
Use constants to represent floating-point, integer, enumeration, or character values that cannot be
modified. C supports several types of constants

Primary Constant - Primary Constant has following sub categories


1. Integer Constant
2. Real constant
3. Character constant
Secondary Constant - Secondary Constant has following sub categories
1. Array
2. Pointer Structure
3. Union
4. Enum

Keywords - Keywords are predefined, reserved words used in programming that have special
meanings to the compiler. Keywords are part of the syntax and they cannot be used as an identifier.
For example
int money;
Here, int is a keyword that indicates 'money' is a variable of type integer.
As C is a case sensitive language, all keywords must be written in lowercase. Here is a list of all
keywords allowed in ANSI C.
Keywords in C Language
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
Along with these keywords, C supports other numerous keywords depending upon the compiler.
List of keywords in C programming language
Character set
Character set is a set of alphabets, letters and some special characters that are valid in C language.

Alphabets
Uppercase: A B C ................................... X Y Z
Lowercase: a b c ...................................... x y z
C accepts both lowercase and uppercase alphabets as variables and functions.
Digits
0123456789
Special Characters in C Programming
,<>._();$:%[]#?' &{}"^ !*/|-\~+
White space Characters
blank space, new line, horizontal tab, carriage return and form feed

Identifiers - Identifier refers to name given to entities such as variables, functions, structures etc.
Identifier must be unique. They are created to give unique name to a entity to identify it during the
execution of the program. For example:
int money;
double accountBalance;
Here, money and accountBalance are identifiers.
Rules for writing an identifier
1. A valid identifier can have letters (both uppercase and lowercase letters), digits and
underscores.
2. The first letter of an identifier should be either a letter or an underscore. However, it is
discouraged to start an identifier name with an underscore.
3. There is no rule on length of an identifier. However, the first 31 characters of identifiers are
discriminated by the compiler.

Variables - In C programming, a variable is a container (storage area) to hold data.


To indicate the storage area, each variable should be given a unique name (identifier). Variable
names are just the symbolic representation of a memory location. For example:
int playerScore = 95;
Here, playerScore is a variable of integer type. The variable is assigned value: 95.
The value of a variable can be changed, hence the name 'variable'.
Rules for naming a variable in C
1. A variable name can have letters (both uppercase and lowercase letters), digits and
underscore only.
2. The first letter of a variable should be either a letter or an underscore. However, it is
discouraged to start variable name with an underscore. It is because variable name that starts
with an underscore can conflict with system name and may cause error.
3. There is no rule on how long a variable can be. However, only the first 31 characters of a
variable are checked by the compiler. So, the first 31 letters of two variables in a program
should be different.
Function - A function is a group of statements that together perform a task. Every C program has at
least one function, which is main(), and all the most trivial programs can define additional functions.
We can divide up our code into separate functions. Each function performs a specific task.

A function declaration tells the compiler about a function's name, return type, and parameters. A
function definition provides the actual body of the function.

Loop - a loop is a sequence of instruction s that is continually repeated until a certain condition is
reached. Typically, a certain process is done, such as getting an item of data and changing it, and
then some condition is checked such as whether a counter has reached a prescribed number.

While loop - A while loop in C programming repeatedly executes a target statement as long as a
given condition is true.
Syntax
while(condition)
{
statement(s);
}
For loop - A for loop is a repetition control structure that allows you to efficiently write a loop that
needs to execute a specific number of times.
Syntax
for ( init; condition; increment )
{
statement(s);
}
Do while loop - Unlike for and while loops, which test the loop condition at the top of the loop,
the do...while loop in C programming checks its condition at the bottom of the loop.
A do...while loop is similar to a while loop, except the fact that it is guaranteed to execute at least one
time.
Syntax
do
{
statement(s);
} while( condition );
Nested loop - C programming allows to use one loop inside another loop.

Nested for loop syntax Nested while loop syntax Nested do while syntax
for ( init; condition; increment ) { while(condition) { do {
statement(s);
for ( init; condition; increment ) { while(condition) {
statement(s); statement(s); do {
} } statement(s);
statement(s); statement(s); }while( condition );
} }
}while( condition );

Das könnte Ihnen auch gefallen