C Set-4

01)Can we use any name in place of argv and argc as command line arguments ?
Ans: yes we can use any user defined name in place of argc and argv;

02)The function fopen() returns a file pointer. Hence a file pointer is declared and it is
assigned
as
FILE *fp;
fp= fopen(filename,mode);

03)What is a file pointer?
Ans: The pointer to a FILE data type is called as a stream pointer or a file pointer. A file pointer
points to the block of information of the stream that had just been opened.

04)
itoa() It converts an integer to string
gcvt() It converts a floating point number to string

05)What do the ‘c’ and ‘v’ in argc and argv stand for?
Ans: The c in argc(argument count) stands for the number of command line argument the
program is
invoked with and v in argv(argument vector) is a pointer to an array of character string that
contain the arguments.

06)Can a Structure contain a Pointer to itself?
Ans: Yes such structures are called self-referential structures.

07)What are built in functions?
Ans: The functions that are predefined and supplied along with the compiler are known as
Builtin functions. They are also known as library functions.

08)what is the similarity between a Structure, Union and enumeration?
Ans: All of them let the programmer to define new data type.

09)What modular programming?
Ans: If a program is large, it is subdivided into a number of smaller programs that are called
modules or subprograms. If a complex problem is solved using more modules, this approach is
known as modular programming.

10)Why is it necessary to give the size of an array in an array declaration?
Ans: When an array is declared, the compiler allocates a base address and reserves enough space
in
memory for all the elements of the array. The size is required to allocate the required space and
hence size must be mentioned.

11)Difference between linker and linkage?
Ans: Linker converts an object code into an executable code by linking together the necessarybuilt in
functions. The form and place of declaration where the variable is declared in a program
determine the linkage of variable.   

12)What is an array of pointers?
Ans: if the elements of an array are addresses, such an array is called an array of pointers

13)What is pointer to a pointer?
Ans: If a pointer variable points another pointer value. Such a situation is known as a pointer to a
pointer.
Example:
int *p1,**p2,v=10;
P1=&v; p2=&p1;
Here p2 is a pointer to a pointer.


14)Pointer variables are initialized by one of the following ways.
I. Static memory allocation
II. Dynamic memory allocation
What is static memory allocation?
Ans: Compiler allocates memory space for a declared variable. By using the address of operator,
the
reserved address is obtained and this address is assigned to a pointer variable. This way of
assigning pointer value to a pointer variable at compilation time is known as static memory
allocation.
 What is dynamic memory allocation?
Ans: A dynamic memory allocation 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 function are assigned to pointer variables, such a way of allocating memory at run time is
known as dynamic memory allocation.


15)What is a NULL Pointer? Whether it is same as an uninitialized pointer?
Ans: Null pointer is a pointer which points to nothing but uninitialized pointer may point to
anywhere.

SHARE

About df

    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment