How to resolve the algorithm Apply a callback to an array step by step in the COBOL programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Apply a callback to an array step by step in the COBOL programming language
Table of Contents
Problem Statement
Take a combined set of elements and apply a function to each element.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Apply a callback to an array step by step in the COBOL programming language
Source code in the cobol programming language
>>SOURCE FORMAT IS FREE
IDENTIFICATION DIVISION.
PROGRAM-ID. map.
DATA DIVISION.
LOCAL-STORAGE SECTION.
01 i USAGE IS INDEX.
01 table-size CONSTANT AS 30.
LINKAGE SECTION.
01 table-param.
03 table-values USAGE IS FLOAT-LONG, OCCURS table-size TIMES.
01 func-ptr USAGE IS PROGRAM-POINTER.
PROCEDURE DIVISION USING BY REFERENCE table-param, BY VALUE func-ptr.
PERFORM VARYING i FROM 1 BY 1 UNTIL i IS GREATER THAN table-size
CALL func-ptr USING BY REFERENCE table-values(i)
END-PERFORM
GOBACK.
END PROGRAM map.
You may also check:How to resolve the algorithm 24 game/Solve step by step in the Ceylon programming language
You may also check:How to resolve the algorithm Hailstone sequence step by step in the Smalltalk programming language
You may also check:How to resolve the algorithm Two's complement step by step in the M2000 Interpreter programming language
You may also check:How to resolve the algorithm Quine step by step in the FutureBasic programming language
You may also check:How to resolve the algorithm 99 bottles of beer step by step in the NS-HUBASIC programming language