Procedure pointers are more efficient than function pointers for ?
-
(1) C/C++-to-COBOL programs calls
-
(2) COBOL-to-C/C++ programs calls
-
(3) COBOL-to-COBOL programs calls
-
(4) C/C++-to-C/C++ programs calls
To answer this question, the user needs to know the difference between procedure pointers and function pointers and their respective use cases.
A function pointer is a pointer that points to a function. It can be used to call the function that it points to. A procedure pointer, on the other hand, is a pointer that points to a procedure. A procedure is similar to a function but does not return a value.
Now, let's go through each option and see which one is correct:
A. (1) C/C++-to-COBOL programs calls: This option is incorrect. Procedure pointers are not typically used in C/C++-to-COBOL programs calls. Instead, function pointers are used for this type of program.
B. (2) COBOL-to-C/C++ programs calls: This option is incorrect. Procedure pointers are not typically used in COBOL-to-C/C++ program calls. Instead, function pointers are used for this type of program.
C. (3) COBOL-to-COBOL programs calls: This option is correct. Procedure pointers are more efficient than function pointers for COBOL-to-COBOL program calls. This is because COBOL does not support function pointers, so procedure pointers must be used instead.
D. (4) C/C++-to-C/C++ programs calls: This option is incorrect. Function pointers are typically used for C/C++-to-C/C++ program calls, not procedure pointers.
Therefore, the correct answer is:
The Answer is: C. (3) COBOL-to-COBOL programs calls
Procedure pointers are more efficient for COBOL-to-COBOL calls because both the caller and callee share the same COBOL runtime calling conventions, avoiding the extra overhead needed to bridge between different language runtimes (as function pointers do for cross-language calls like C/C++ to COBOL).