[TRNSYS-users] sizeof array

Jörn von Grabe v.Grabe at bv.tu-muenchen.de
Mon Jul 28 03:02:39 PDT 2008


dear all!

 

my type - written in c++ -  needs a dynamic number of inputs and outputs. this i implement by a cycle in the proforma. thus, the xin and xout arrays do not have a constant size anymore which can be set in the source code directly. instead, i have to determine the size of the arrays dynamically. i tried sizeof(xin/xout), this however yields the size of the bytes needed by the variabel type, but not the number of the array elements. as far as i understand, the arrays that are passed are c-arrays, not c++arrays (for c++ arrays sizeof yields the total number of bytes of the array so that the number of elements are given by sizeof(array)/sizeof(type)) . how do i get the number of elements? can c-arrays easily be converted into c++arrays (not my favourite)? are c-arrays generally 0-terminated (i can remember anymore...)? does anyone have a simple solution which i am to blind to see???

 

regards

jörn

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.onebuilding.org/pipermail/trnsys-users-onebuilding.org/attachments/20080728/52d88243/attachment-0005.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: J?rn von Grabe.vcf
Type: text/x-vcard
Size: 135 bytes
Desc: J?rn von Grabe.vcf
URL: <http://lists.onebuilding.org/pipermail/trnsys-users-onebuilding.org/attachments/20080728/52d88243/attachment-0005.vcf>


More information about the TRNSYS-users mailing list