C Language Interview Question and Answers
6. |
What is this pointer? |
|
The this pointer is a pointer accessible only within the member functions of a class, struct, or union type. It points to the object for which the member function is called. Static member functions do not have a this pointer. |
|
Sambasivarao, said |
Mar 14, 2014 |
this pointer is used to point the invoking structure. |
|
7. |
What are the uses of a pointer? |
|
Pointer is used in the following cases- It is used to access array elements.
- It is used for dynamic memory allocation.
- It is used in Call by reference.
- It is used in data structures like trees, graph, linked list etc.
|
|
|
8. |
What is the purpose of main() function? |
|
The function main() invokes other functions within it.It is the first function to be called when the program starts execution.
- It is the starting function.
- It returns an int value to the environment that called the program.
- Recursive call is allowed for main( ) also.
- It is a user-defined function.
|
|
Jyothi, said |
May 07, 2014 |
Main() function in c program is a predefined function. We can change its protype other than name. If we give a different name then it becomes user defined function. |
Sambasivarao, said |
Mar 14, 2014 |
Operating system starts the execution from the main() function. only main function is allowed in c language. |
|
9. |
What are the different storage classes in C? |
|
There are four types of storage classes.- Automatic
- Extern
- Regiter
- Static
|
|
Appu, said |
May 01,2014 |
Automatic variables are accessed within the same function in which they are declared. Extern works like a global variable. Register variable is used to store the value temporarily, before any operation can be perfom on it. static is similar to auto variable.static don't loose its value after execution of function terminates.
|
|
10. |
Define inheritance? |
|
Inheritance is the process by which objects of one class acquire properties of objects of another class. |
|
|