Conversion of values in structure with _itoa in example below is not successful. Do anybody see any mistake I made?
/* typedef struct struct_rect { int x; int y; int w; int h; }rectangle; struct struct_objects { int sort; rectangle rect; ALLEGRO_COLOR color; }objects[1000]; int number_of_objects = 2; */ bool print_objects() { char value_string[100]; int i; for (i = 0; i < number_of_objects; i++) { memset(value_string, '\0', sizeof(value_string)); _itoa(objects[i].sort, value_string, 30); printf("%i x %s\n", objects[i].sort, value_string); memset(value_string, '\0', sizeof(value_string)); _itoa(objects[i].rect.x, value_string, 30); printf("%i x %s\n", objects[i].rect.x, value_string); memset(value_string, '\0', sizeof(value_string)); _itoa(objects[i].rect.y, value_string, 30); printf("%i x %s\n", objects[i].rect.y, value_string); memset(value_string, '\0', sizeof(value_string)); _itoa(objects[i].rect.w, value_string, 30); printf("%i x %s\n", objects[i].rect.w, value_string); memset(value_string, '\0', sizeof(value_string)); _itoa(objects[i].rect.h, value_string, 30); printf("%i x %s\n", objects[i].rect.h, value_string); } return true; } output is(values in left column are correct, in right column not):
0 x 0
20 x k
50 x 1k
50 x 1k
50 x 1k0 x 0
150 x 50
300 x a0
20 x k
200 x 6k