Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Fixing type mis-matches

kentdeeg
Beginner
247 Views
I have, as an example, the following line of code: q = card( col )

the variable CARD is typed as CHAR*1; q is typed as INTEGER.
The compile barfed on this one. Does this tell me that the left side of an equation must match the right side?

My question; Can this diagnostic be "cleared' by adding the followin card images:

BYTE bfile( 72 ) then add EQUIVALENCE( CARD, BFILE )
with the corresponding initial statement q = BFILE( col )? Will that, in general, fix dthe mis-match diagnostic error message?

Thanks, kentdeeg
0 Kudos
1 Reply
Steven_L_Intel1
Employee
247 Views
There is conversion between numeric types, but not between numeric and character. (The Intel compiler also provides, as an extension, conversion between LOGICAL and numeric types).

Let me suggest instead that you write:

q = IACHAR(card(col)) This will do the conversion you want - IACHAR accepts a character as an argument and returns, as an integer, the position within the ASCII collating sequence, which is the effect you want.
0 Kudos
Reply