Monday 2 July 2012

Memory and sizeof in C

1.Memory in C
Variables in the stack area are always deleted when program control reaches it out of scope
variable  in the data area  will store in the memory unless and until program end

Output: ?
2.sizeof in C
sizeof của các biến trong c , phụ thuộc vào trình biên dịch ( compiler) .Tuy nhiên kiểu char là kiểu dữ liệu mã ASCII nên là 1 byte ( char - 1 byte)

Size of data types in c

Size of data types in the 16 bit compilers, like TURBO c++, Borland c++ etc.

Size of data types in the 32 bit compilers. Example: LINUX gcc compiler
Kích thước của struct
các biến trong truct được luu trữ  trong stack area  . các biến khai báo được  theo cách ngăn xếp (LIFO) .
hãy cho biết kết quả của các ví dụ sau đây.
Output ?

Output ?

Output ?



Output ?

Output ?
//-------------------------------------------------------------------------------
Output ?

Output ?
//----------------------------------------------------------------------------
char type

int type


//-----------------------------------------------------------------------------

//----------------------------------------------------------------------------
Output ?
//---------------------------enum-----------------------------------------
 

Output ?
//-----------------------------------------------------------------------------

No comments:

Post a Comment