You are recommended to allocate the exception block on the stack, rather than the heap. This is to simplify possible memory allocations, although there is no programmatic restriction on allocating space on the heap.
In its simplest form your code would look like this:
MQERETURN rc MQeExceptBlock exceptBlock; /* .... initialisation */ rc = mqeFunction_anyFunction(&exceptBlock, /* parameters go here */ ); if (MQERETURN_OK != rc ) { printf("An error has occured , return code = %d, reason code = %d \n", exceptBlock.ec exceptBlock.erc); } else { }
If you are not interested in the status of a call, NULL can be passed as the Exception Block.