Right. So why do you have 7 arguments in the first place? Because you have three arrays, and each has a size argument, and then you need a result size as well.
Oh, and a few more comments on your code:
Whilst this does indeed set the location pointed to by pSize to counter, it is probably a better option to do:Code:pSize[0] = counter; // return by pointer the size of the result array
since pSize is not an array of one element, it is the address of a single integer. [and please do not allocate 1 integer's worth of space. Use a local variable and take it's address, e.g.Code:*pSize = counter; // return by pointer the size of the result arrayDo not use standard names for variables:Code:int resultSize; ... result = culc_U(...., &resultSize);
Bad name for a variable - there is a standard type called size_t. You wouldn't call a variable "int" or "float", would you?Code:size_t
Do not mix initialize and uninitialized variables on the same line - it's hard to follow (I personally also dislike LONG lists of variables on one line - if there are two or three closely connected variables, they may be on the same line - but not 8 different variables which aren't closely connected).Code:int j, groups_num, size_u, size_x, size_y, size_z, size_exp = 0, size_t = 0, *p_size;
--
Mats



LinkBack URL
About LinkBacks



