fork download
  1. void undef (char *name)
  2. {
  3. struct nlist *curr, **ptrToCurr;
  4. unsigned hashval;
  5.  
  6. hashval = hash(name);
  7. curr = hashtab[hashval];
  8. ptrToCurr = &hashtab[hashval];
  9. while (curr != NULL && strcmp(name, curr->name)!= 0)
  10. {
  11. printf("while loop\n");
  12. ptrToCurr = &curr->next;
  13. curr = curr->next;
  14. }
  15.  
  16. printf("after loop\n");
  17. if (curr)
  18. {
  19. *ptrToCurr = curr->next;
  20. free ((void *) curr->name);
  21. free ((void *) curr->defn);
  22. free (curr);
  23. }
  24. }
  25.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function 'undef':
prog.c:6:19: warning: implicit declaration of function 'hash' [-Wimplicit-function-declaration]
         hashval = hash(name);
                   ^
prog.c:7:16: error: 'hashtab' undeclared (first use in this function)
         curr = hashtab[hashval];
                ^
prog.c:7:16: note: each undeclared identifier is reported only once for each function it appears in
prog.c:9:24: error: 'NULL' undeclared (first use in this function)
         while (curr != NULL && strcmp(name, curr->name)!= 0)
                        ^
prog.c:9:32: warning: implicit declaration of function 'strcmp' [-Wimplicit-function-declaration]
         while (curr != NULL && strcmp(name, curr->name)!= 0)
                                ^
prog.c:9:49: error: dereferencing pointer to incomplete type 'struct nlist'
         while (curr != NULL && strcmp(name, curr->name)!= 0)
                                                 ^
prog.c:11:17: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
                 printf("while loop\n");
                 ^
prog.c:11:17: warning: incompatible implicit declaration of built-in function 'printf'
prog.c:11:17: note: include '<stdio.h>' or provide a declaration of 'printf'
prog.c:16:9: warning: incompatible implicit declaration of built-in function 'printf'
         printf("after loop\n");
         ^
prog.c:16:9: note: include '<stdio.h>' or provide a declaration of 'printf'
prog.c:20:17: warning: implicit declaration of function 'free' [-Wimplicit-function-declaration]
                 free ((void *) curr->name);
                 ^
prog.c:20:17: warning: incompatible implicit declaration of built-in function 'free'
prog.c:20:17: note: include '<stdlib.h>' or provide a declaration of 'free'
prog.c:4:18: warning: variable 'hashval' set but not used [-Wunused-but-set-variable]
         unsigned hashval;
                  ^
stdout
Standard output is empty