I have a function that takes a void** argument and an integer that indicates its datatype
void foo (void** values, int datatype)
Run Code Online (Sandbox Code Playgroud)
Inside the function, depending on the datatype, I malloc it this way:
if (datatype == 1)
*values = (int*) malloc (5 * sizeof(int));
else if (datatype == 2)
*values = (float*) malloc (5 * sizeof(float));
Run Code Online (Sandbox Code Playgroud)
All is good upto now. However, when character strings come into the picture, things get complicated. The void** would need to be void*** …
Fortran 是否曾经像 C 那样处理任意长度的子例程参数列表?(顺便说一句,“礼物”对我想做的事情不起作用。)谢谢。