Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

array size

hki75
2014-11-07
2014-11-08
  • hki75 - 2014-11-07

    if I define an array as:

    MyArray : ARRAY [0..63] OF BOOL;

    is there some instruction that get back the array-elements size (64 in my sample)?

    Regards

     
  • hki75 - 2014-11-07

    I'm answering myself.. SIZEOF (return number of bytes of a variable) but need to consider the type of data (ex. byte or int or...)

     
  • shooter - 2014-11-08

    well if you need the number of elements it is 63-0 +1
    the size is the number of bytes needed a boolean is byte size.+2
    if you try it what is result? 65!!
    for an INT it is 2*64+2 is 130,
    etc

     

Log in to post a comment.