Generally, loops are dependent on one or more variables. Your program can check those variables outside the loop to ensure that the loop executed properly. For instance, consider the following example:
#define REQUESTED_BLOCKS 512 int x; char* cp[REQUESTED_BLOCKS];
/* Attempt (in vain, I must add...) to allocate 512 10KB blocks in memory. */