Sie sind auf Seite 1von 4

1) C midlevel Language

2) No run-time error checking


3) C89 -32 Keyword C99- 32+5 Key words- 1) _Bool 2) _Imaginary 3) restrict 4) _
Complex 5) inline
4) Structured Language-a block-structured language is that blockstructured
languages permit procedures or functions to be declared
inside other
procedures or functions. However, since C does not allow
the creation of functions
within functions, it cannot formally be called block-str
uctured
5)compartmentalization of code and data-ability of a language to section off and
hide from the rest of the program all information and
instructions necessary to perform
a specific task
6)C was designed to be compiled
7)C memory Map
STACK
- LIFO
Automatic variables, function address
are stored ,For each function call new stack frame is formed
HEAP
- Dynamic Memory Allocation
Unintialized Variable - bss -block started by symbol - Uninitialized Sta
tic and Global Variables are stored
Initialized Variable
- Data Segment - Initialized Static and Global V
ariables are stored
Text
- Source Code
8)Steps of Compilation process- Preprocessing ->Compilation->Assembly->Linking
9)Basic Data types- char - usually byte , int - usually the same as the word len
gth of the execution environment ,
float -1E 37 to 1E+37 with six digits of precision , double 1E 37 to 1E+37 with ten digits of precision , and void
10)Modifiers - used to modify basic data types,
signed
unsigned
long
short
11) Data Type sizes
Type

Bits

char
unsigned char
signed char
int
16
unsigned int
16
signed int
16
short int
unsigned short int
signed short int
long int
long long int
signed long int
unsigned long int
unsignwd long long int
float
double
long double

8
8
8
or 32
or 32
or 32
16
16
16
32
64
32
32
64
32
64
80

RANGE
127 to 127
0 to 255
127 to 127
32,767 to 32,767
0 to 65,535
Same as int
32,767 to 32,767
0 to 65,535
Same as short int
2,147,483,647 to 2,147,483,647
(263 1) to 263 1 (Added by C99)
Same as long int
0 to 4,294,967,295
264 1 (Added by C99)
1E 37 to 1E+37 with six digits of precision
1E 37 to 1E+37 with ten digits of precision
1E 37 to 1E+37 with ten digits of precision

12) Signed value storing


High order bit tells positive or negative
0 - positive ,1 - negative
rest of the values are twos complimented and stored
Example: -25 is stored as 11100111
13)A declaration declares the name and type of an object. A definition causes st
orage to be allocated for the object.
The same object may have many declarations, but there can be only one definit
ion
14)Variable in the block only valid ,example
int a=10; global
void printer()
{
int a=18; automatic
putc(a); it will print 18
}
15)local variables are stored on the stack(except static )
16)Formal Parameter -If a function is to use arguments, it must declare variable
s that will accept the values of the
arguments. These variables are called the formal parameters of the function. The
y behave like any
other local variables inside the function.
17)Storage for global variables is in a fixed region of memory
18) Scopes
i) FILE SCOPE
ii) FUNCTION SCOPE
iii)FUNCTION PROTOTYPE SCOPE
example:void fn (struct st {int a;} a, struct st b) ;
struct st obj ; // St is not valid type
iV) BLOCK SCOPE
19)Type Qualifiers
const - value is stored in read only memory , value cannot be modified inside
program,value can be modified outside the
program ,i.e it can be modified by hardware means
volatile -tells the compiler that a variable's value may be changed in ways n
ot explicitly specified by the program.
For example, a global variable's address may be passed to the opera
ting system's clock routine and used to hold
the system time
const and volatile together
For example
const volatile char *port = (const volatile char *) 0x30;
if 0x30 is assumed to be the value of a port that is changed by
external conditions only,
the following declaration would prevent any possibility of accid
ental side effects
20) Storage class

extern static segment


register converted
auto
-

declaration of varible that is declared already in some other scope


In Function scope it ill retain the value , and stored in bss or data
stored in cpu register (depends on the avail of register , other wise
to auto type)
local variable

21) Operators -arithmetic, relational , logical,and bitwise


22) lvalue- If that object can occur on the left side of an assignment statement
, it is called a modifiable lvalue.
rvalue- refers to expressions on the right side of an assignment and simply
means the value of an expression.
23) Arithmetic Operators Precedence
Highest
++
ID
(unary minus)
U
* / %
MDM
+
AS
Lowest
24) Relational and Logical operators
Highest
!
> >= < <=
== !=
&&
||
Lowest
25) Ternary operator
Exp1 ? Exp2: Exp3;
26) Left shift one time is multiply of 2 , Right shift one time is divide by 2
27) Compile-Time Operator - sizeof
28) Comma Operator - The comma operator has somewhat the same meaning as the wor
d "and" in English, as used in the
phrase "do this and this and this.
Example
x = (y=3, y+1);
now x value is
29) Evaluation - All operators, except the unary operators and ?, associate from
left to right. The unary operators (*, &, )
and ? associate from right to left
30) Precedence
Highest
( ) [ ] >.
! ~ ++
(type) * & sizeof
* / %
+
<< >>
< <= > >=
== !=
&
^
|
&&

||
?:
= +=
,

= *= /= etc.

Lowest
31) Type conversion - The compiler converts all operands up to the type of the l
argest operand, which is called type promotion
32)There is one additional special case: If one operand is long and the other is
unsigned int, and if the
value of the unsigned int cannot be represented by a long, both operands are
converted to unsigned long
33)True - value other than zero (including negative value) and False - zero valu
e
34)Difference btw switch and if
switch - switch can only test for equality
- int type only evaluated
- No two case constants in the same switch can have identical val
ues
35) Cant pass array as argument to the function ,how ever pass a pointer to an a
rray by specifying the array's name without an index
36) char *a ,char a[10] ,char a[] all these are valid to recieve pointer to the
array (function formal parameters)
37) char arr[2][5];
arr[1] is equal to &arr[1][0]
38)p[5] = 100; /* assign using index */
*(p+5) = 100; /* assign using pointer arithmetic */
39)a[j][k] is equivalent to *((base type *)a+(j*row length)+k)
40)The cast of the pointer to the array into a pointer of its base type is neces
sary in order for the pointer
arithmetic to operate properly. Pointers are sometimes used to access arrays bec
ause pointer arithmetic is often faster than array indexing
41)Array of pointers can be used to hold strings
char *str[]=
{
"Printing",
"Error Occured",
"Completed"
};
42)char *p = "hello world";
perfectly valid , this string will be stored in the string table and can be
accessable through out the program

Das könnte Ihnen auch gefallen