to access the data pointed to by them
Arrays use subscripted variables to access and manipulate data. Array variables can be
equivalently written using pointer expression.
pointer to a block of memory for which the size is to be altered. The second argument n
new size. The size may be increased or decreased. If n is greater than the old size and if
sufficient space is not available subsequent to the old region, the function realloc ( )
may create a new region and all the old data are moved to the new region.
a declared variable. By using the address of operator, the reserved address is obtained and this address may be assigned to a pointer variable. Since most of the declared variable has static memory, this way of assigning pointer value to a pointer variable is known as static memory allocation. Memory is assigned during compilation time.
Dynamic memory allocation: It uses functions such as malloc ( ) or calloc ( ) to get
memory dynamically. If these functions are used to get memory dynamically and the
values returned by these functions are assigned to pointer variables, such assignments are
known as dynamic memory allocation. Memory is assigned during run time.
\u00d8 It is easier to understand the logic involved in the program
\u00d8 Testing is easier
\u00d8 Recursive call is possible
\u00d8 Irrelevant details in the user point of view are hidden in functions
\u00d8 Functions are helpful in generalizing the program
be called when the program starts execution.
\u00d8 It is the starting function
\u00d8 It returns an int value to the environment that called the program
\u00d8 Recursive call is allowed for main( ) also.
\u00d8 It is a user-defined function
\u00d8 Program execution ends when the closing brace of the function main( ) is reached.
\u00d8 It has two arguments 1)argument count and 2) argument vector (represents strings
\u00d8 Any user-defined name can also be used as parameters for main( ) instead of argc and
subprograms. Each subprogram specifies one or more actions to be performed for a large
program. Such subprograms are functions.
The function supports only static and extern storage classes. By default, function assumes
extern storage class. Functions have global scope. Only register or auto storage class is
allowed in the function parameters. Built-in functions that predefined and supplied along
with the compiler are known as built-in functions. They are also known as library
Question: When does the compiler not implicitly generate the address of the first
element of an array?
Answer: Whenever an array name appears in an expression such as
\u00d8 array as an operand of the sizeof operator
\u00d8 array as an operand of & operator
\u00d8 array as a string literal initializer for a character array
4) Array name represents the address of the starting element
5) Array size should be mentioned in the declaration. Array size must be a constant
2)There is no side effect by changing the values in the blocks
3)The memory is economically used
4)Auto variables have inherent protection because of local scope.
the lifetime, scope and linkage.
There are five types of storage classes
This action might not be possible to undo. Are you sure you want to continue?