[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[TRNSYS-users] sizeof array



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

 

 

BEGIN:VCARD
VERSION:2.1
N:von Grabe;Jörn
FN:Jörn von Grabe
EMAIL;PREF;INTERNET:v.grabe@bv.tum.de
REV:20080212T160915Z
END:VCARD