The following table shows the correspondence between the data types that are available in COBOL and C/C++.
| C/C++ data types | COBOL data types |
|---|---|
| wchar_t | USAGE NATIONAL (PICTURE N) |
| char | PIC X |
| signed char | No appropriate COBOL equivalent |
| unsigned char | No appropriate COBOL equivalent |
| short signed int | PIC S9-S9(4) COMP-5. Can be COMP, COMP-4, or BINARY if you use the TRUNC(BIN) compiler option. |
| short unsigned int | PIC 9-9(4) COMP-5. Can be COMP, COMP-4, or BINARY if you use the TRUNC(BIN) compiler option. |
| long int | PIC 9(5)-9(9) COMP-5. Can be COMP, COMP-4, or BINARY if you use the TRUNC(BIN) compiler option. |
| long long int | PIC 9(10)-9(18) COMP-5. Can be COMP, COMP-4, or BINARY if you use the TRUNC(BIN) compiler option. |
| float | COMP-1 |
| double | COMP-2 |
| enumeration | Analogous to level 88, but not identical |
| char(n) | PICTURE X(n) |
| array pointer (*) to type | No appropriate COBOL equivalent |
| pointer(*) to function | PROCEDURE-POINTER or FUNCTION-POINTER |
related tasks
Passing data between COBOL and C/C++
related references
TRUNC