Final answer:
The illegal function prototype is Option B which is int getSum(int[ ], int y, *k);. Option B, 'int getSum(int[ ], int y, *k);', is the illegal function prototype because the type for parameter 'k' is not specified, which violates C++ syntax rules. Therefore, option B is the correct answer.
Step-by-step explanation:
The illegal function prototype is Option B which is int getSum(int[ ], int y, *k);. In this option, the array parameter is not correctly defined as it is missing a dimension. The correct way to define an array parameter is to specify its size. For example, int getSum(int array[ ], int size, int* k);
Option B, 'int getSum(int[ ], int y, *k);', is the illegal function prototype because the type for parameter 'k' is not specified, which violates C++ syntax rules.
The student's question involves identifying an illegal function prototype among the given options. In C++, function prototypes must adhere to specific syntax rules to be considered valid. Here is a breakdown of each option:
A. int getSum(int y, int z, int*); is legal because it specifies a function that takes two integers and a pointer to an integer as arguments.
C. int getSum(int z, int k = 4); is legal and includes a default argument for the second parameter.
D. int getSum(int[10]); is legal and means that the function takes an array of 10 integers as an argument.
Therefore, option B is the illegal function prototype because it lacks the type specification for the parameter *k.
Among the provided function prototypes, option B. `int getSum(int[ ], int y, *k);` is illegal.
A. int getSum(int y, int z, int*);
This prototype is legal. It defines a function named `getSum` that takes two integer parameters (`y` and `z`) and a pointer to an integer (`int*`).
B. int getSum(int[ ], int y, *k);
This prototype is illegal. The parameter declaration for the array is incomplete. It should specify the type of the elements in the array. Also, the pointer declaration `*k` is missing the type of the pointed-to variable. The correct version would be something like `int getSum(int[], int y, int* k);`.
C. int getSum(int z, int k = 4);
This prototype is legal. It defines a function named `getSum` that takes two integer parameters (`z` and `k` with a default value of 4 for `k`).
D. int getSum(int[10]);
This prototype is legal. It defines a function named `getSum` that takes an array of 10 integers as a parameter.
In summary, option B is illegal due to incomplete and incorrect parameter declarations for the array and pointer.