The C Language is developed for
creating system applications that direct interacts to the hardware devices such
as drivers, kernals etc.
printf() function
The printf()
function is used for output. It prints the given statement to the
console.
1. printf("format string",argument_list);
The format string can
be %d (integer), %c (character), %s (string), %f (float) etc.
scanf() function
The scanf()
function is used for input. It reads the input data from the console.
1. scanf("format string",argument_list);
It is a way to represent memory location through symbol so that it can be easily identified.
Let's see the syntax to declare a variable:
type variable_name;
Rules for defining variables
- A variable can have alphabets, digits and underscore.
- A variable name can start with alphabet and underscore only. It can't start with digit.
- No white space is allowed within variable name.
- A variable name must not be any reserved word or keyword e.g. int, float etc.
Types of Variables in C
There are many types of variables in c:
- local variable
- global variable
- static variable
- automatic variable
- external variable
Basic Data TypesThe basic data types are integer-based and floating-point based. C language supports both signed and unsigned literals.The memory size of basic data types may change according to 32 or 64 bit operating system. Let's see the basic data types. Its size is given according to 32 bit architecture.
An operator is simply a symbol that is used to perform operations. There can be many types of operations like arithmetic, logical, bitwise etc.
There are following types of operators to perform different types of operations in C language.
|
Category | Operator | Associativity |
---|---|---|
Postfix | () [] -> . ++ - - | Left to right |
Unary | + - ! ~ ++ - - (type)* & sizeof | Right to left |
Multiplicative | * / % | Left to right |
Additive | + - | Left to right |
Shift | << >> | Left to right |
Relational | < <= > >= | Left to right |
Equality | == != | Left to right |
Bitwise AND | & | Left to right |
Bitwise XOR | ^ | Left to right |
Bitwise OR | | | Left to right |
Logical AND | && | Left to right |
Logical OR | || | Left to right |
Conditional | ?: | Right to left |
Assignment | = += -= *= /= %=>>= <<= &= ^= |= | Right to left |
Comma | , | Left to right |
No comments:
Post a Comment