fork download
  1. int parse_answer(char **buffer_start, char *buffer_end, char **curr_ptr, size_t *curr_size)
  2. {
  3. if(*buffer_start >= buffer_end){
  4. return 0;
  5. }
  6. *curr_ptr = *buffer_start;
  7. while(**buffer_start != ','){
  8. (*buffer_start)++;
  9. }
  10. (*buffer_start)++;
  11.  
  12. *curr_size=*buffer_start-*curr_ptr-1;
  13.  
  14. return 1;
  15. }
  16.  
  17.  
  18.  
  19. void test(){
  20. int answer_size;
  21. char answer_buffer[ANSWER_BUFFER_SIZE];
  22. char *buffer_start;
  23. char *buffer_end;
  24. char *curr_ptr;
  25. size_t curr_size;
  26.  
  27. ...
  28. //reading answer_here
  29. ...
  30.  
  31. buffer_start = answer_buffer;
  32. buffer_end = &answer_buffer[answer_size];
  33.  
  34. i=0;
  35. while(parse_answer(&buffer_start,buffer_end,&curr_ptr,&curr_size)) {
  36. printf("%2d:%.*s\n",i,curr_size,curr_ptr);
  37. i++;
  38. }
  39.  
  40. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c:1: error: expected declaration specifiers or ‘...’ before ‘size_t’
prog.c: In function ‘parse_answer’:
prog.c:12: error: ‘curr_size’ undeclared (first use in this function)
prog.c:12: error: (Each undeclared identifier is reported only once
prog.c:12: error: for each function it appears in.)
prog.c: In function ‘test’:
prog.c:21: error: ‘ANSWER_BUFFER_SIZE’ undeclared (first use in this function)
prog.c:25: error: ‘size_t’ undeclared (first use in this function)
prog.c:25: error: expected ‘;’ before ‘curr_size’
prog.c:27: error: expected expression before ‘...’ token
prog.c:34: error: ‘i’ undeclared (first use in this function)
prog.c:35: error: ‘curr_size’ undeclared (first use in this function)
prog.c:35: error: too many arguments to function ‘parse_answer’
prog.c:36: warning: implicit declaration of function ‘printf’
prog.c:36: warning: incompatible implicit declaration of built-in function ‘printf’
prog.c:21: warning: unused variable ‘answer_buffer’
stdout
Standard output is empty