struct NestedLoopArg* arg = (NestedLoopArg*)calloc(2, sizeof(NestedLoopArg)); args[0].ptr_type = 0; /* array */ args[0].ptr.array.type_ptr = &IntType; args[0].ptr.array.length = 5; args[0].ptr.array.ptr = calloc(arg[0].array.length, arg[0].array.elem_size); args[1].ptr_type = 1; /* mixed array */ args[1].ptr.mixed.length = 4; args[1].ptr.mixed.ptr = (Element*)calloc(arg[0].array.length, sizeof(struct Element)); { ... populate args[1].mixed.ptr[] ... } args[2].ptr_type = 2; /* func */ args[2].ptr.func.ptr = my_func; struct MyFuncPad arg2_pad; arg2_pad.count = 5; args[2].ptr.func.pad = &arg2_pad; NestedLoops(args); ... free memory allocated for args ...