fork download
  1. #ifndef FUNCTION07_H_
  2. #define FUNCTION07_H_
  3.  
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6.  
  7. void sort_by_length (char* strings[], int size);
  8.  
  9. int main() {
  10. int size;
  11. scanf("%d", &size);
  12. char** strings;
  13. strings = (char**) malloc(sizeof(char*) * 100000);
  14. for (int i = 0; i < size; i ++) {
  15. strings[i] = (char*) malloc(sizeof(char) * 21);
  16. scanf("%s", strings[i]);
  17. }
  18. sort_by_length(strings, size);
  19. for (int i = 0; i < size; i ++) {
  20. printf("%s%c", strings[i], " \n"[i == size - 1]);
  21. }
  22. return 0;
  23. }
  24. #endif // FUNCTION7_H_
  25.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function ‘main’:
prog.c:11:5: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &size);
     ^~~~~~~~~~~~~~~~~~
prog.c:16:9: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
         scanf("%s", strings[i]);
         ^~~~~~~~~~~~~~~~~~~~~~~
/usr/bin/ld: /home/w9Ju60/cc30PTFC.o: in function `main':
prog.c:(.text.startup+0x7c): undefined reference to `sort_by_length'
collect2: error: ld returned 1 exit status
stdout
Standard output is empty