fork(1) download
  1. #include "stdio.h"
  2. #include "limits.h"
  3.  
  4. typedef struct TempStruct TempStruct;
  5.  
  6. struct TempStruct
  7. {
  8. int a;
  9. TempStruct *next;
  10. };
  11.  
  12. int function1(TempStruct *param)
  13. {
  14. return param == NULL;
  15. }
  16.  
  17. int function2(TempStruct **param)
  18. {
  19. if(function1(param))
  20. {
  21. return INT_MIN;
  22. }
  23. *param = (*param)->next;
  24. return 0;
  25. }
  26.  
  27. int main()
  28. {
  29. TempStruct *tempStructObj = NULL;
  30. function2(&tempStructObj);
  31. printf("Does not reach here!!!");
  32. return 0;
  33. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function 'function2':
prog.c:19:18: error: passing argument 1 of 'function1' from incompatible pointer type [-Werror=incompatible-pointer-types]
     if(function1(param))
                  ^
prog.c:12:5: note: expected 'TempStruct * {aka struct TempStruct *}' but argument is of type 'TempStruct ** {aka struct TempStruct **}'
 int function1(TempStruct *param)
     ^
cc1: all warnings being treated as errors
stdout
Standard output is empty