Facebook
From to ja, 1 Week ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 35
  1. city_t *new_city (const char *name) {
  2.     city_t *ret = malloc(sizeof(city_t));
  3.     ret->name = name;
  4.     ret->roads = NULL; //tymczasowe, TODO
  5.     ret->visit = false;
  6.     ret->distance = 0;
  7.     ret->prev = NULL;
  8.     ret->position = 0;
  9.     ret->next = NULL; //TODO
  10.  
  11.     printf("adres reta %ld\n", ret);
  12.     fflush(stdout);
  13.  
  14.     return ret;
  15. }
  16.  
  17.  
  18. int main () {
  19.     city_t *a = new_city("Aa");
  20.     printf("adres a %ld\n", a);
  21.     fflush(stdout);
  22.     printf("%u %u", a->distance, a->position);
  23.     //tu segfault, wiÄ™c dalej whatever
  24.    
  25. }