10. Stromy

Jan Faigl 2025/09/19 22:07

 while (!feof(f) && !exit) {                               ->          while (!exit) {
      if (g->num_edges == g->capacity) {                                    if (g->num_edges == g->capacity) {
         enlarge_graph(g);                                                      enlarge_graph(g);
      }                                                                      }
      edge_t *e = g->edges + g->num_edges;                                   edge_t *e = g->edges + g->num_edges;
      while (!feof(f) && g->num_edges < g->capacity) {     ->                while (g->num_edges < g->capacity) {
Funkce feof() vrací logickou hodnotu TRUE pouze v případě dosažení konce souboru, což je detekováná až při pokusu o čtení. Vždy je proto nutné kontrolovat návratové hodnoty čtecích funkcí více např. viz https://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1046476070&id=1043284351

courses/b0b36prp/lectures/lec10.txt · Last modified: 2025/09/19 22:09 by faiglj