Guest User

Untitled

a guest
Jul 17th, 2018
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.49 KB | None | 0 0
  1. fopen(...);
  2. if(/* Error */){
  3.     return 1;
  4. }
  5. malloc(...);
  6. if(/* Error */){
  7.     fclose(...);
  8.     return 2;
  9. }
  10. parseInt(...);
  11. if(/* Error */){
  12.     free(...);
  13.     fclose(...);
  14.     return 3;
  15. }
  16. //Stuff
  17. free(...);
  18. fclose(...);
  19. return 0;
  20.  
  21. /* VS */
  22.  
  23. int error = 0;
  24. fopen(...);
  25. if(/* Error */){
  26.     error = 1;
  27.     goto q;
  28. }
  29. malloc(...);
  30. if(/* Error */){
  31.     error = 2;
  32.     goto fc;
  33. }
  34. parseInt(...);
  35. if(/* Error */){
  36.     error = 3;
  37.     goto fr;
  38. }
  39. //Stuff
  40. fr: free(...);
  41. fc: fclose(...);
  42. q: return error;
Add Comment
Please, Sign In to add comment