4.1

Identify the error in the following program.

Answer

Here two function are same except return type. Function overloading can be used using different argument type but not return type.

Correction : This error can be solved as follows :

4.2

Identify the error in the following program.

Answer

4.3

Identify the error in the following program.

Answer

Here cout << : gvalue << ” “; replace with cout <<::gvalue<< ” “;

4.4

Find errors, if any, in the following function definition for displaying a matrix: void display(int A[][], int m, int n)

Answer

First dimension of an array may be variable but others must be constant.

Here int A [ ] [ ] replace by the following code:
int A [ ] [10];
int A[10] [10];
int A[ ] [size];
int A [size] [size];

Where const int size = 100;
any other numerical value can be assigned to size.


Next Previous