Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Tom Rettigs Library - atype(<c array name>[[<n element number>]]) http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 ATYPE(<C array name>[[<N element number>]])
 Distinguishes arrays from memvars, and determines type of an array element.
 Returns <expC> uppercase letter indicating data type.

 Type              Returns
 -------------     -------------------------------------------
 Array             A
 Block             B (5.0 and later)
 Character         C
 Date              D
 Logical           L
 Numeric           N
 Object            O (5.0 and later)
 Uninitialized     U (NIL, local, and static in 5.0 and later)


 * Assume an existing array with 100 mixed data elements
 elements = 100

 * Declare new arrays to hold two individual data types
 DECLARE char_array[ elements ], num_array[ elements ]

 STORE 1 TO char_index, num_index
 FOR old_index = 1 to elements
    DO CASE
       CASE ATYPE( old_array[old_index] ) = "C"
          char_array[char_index] = old_array[old_index]
          char_index = char_index + 1
       CASE ATYPE( old_array[old_index] ) = "N"
          num_array[num_index] = old_array[old_index]
          num_index = num_index + 1
    ENDCASE
 NEXT

 * Evaluate how many array elements were initialized
 char_index = 1
 DO WHILE ATYPE( char_array[char_index] ) # "U"
    char_index = char_index + 1
 ENDDO


             Placed in the Public Domain by Tom Rettig Assoc.

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson