使用struct时C中的for循环问题

我做了以下代码来从文本文件中读取值。文本文件看起来像这样。(在代码中,它被命名为annotation.txt)

299.jpg
480
640
3
dog
124
234
380
290
hand
789
456
234
123
wire
900
567
456
234

这是代码。

#include <stdio.h>
#include <stdlib.h>

typedef struct object
{
    char obj_name[20];
    int x_min;
    int y_min;
    int x_max;
    int y_max;

} Object;

typedef struct annotation
{
    char img_name[20];
    int width;
    int height;
    int num_obj;

    Object objects[];
} Annotation;

void readAnnotation(char *fileName, Annotation *annot);

int main()
{
    Annotation annot;
    readAnnotation("annotation.txt", &annot);

    printf("%s\n", annot.img_name);
    printf("%d\n", annot.width);
    printf("%d\n", annot.height);
    printf("%d\n", annot.num_obj);
    printf("0th object name for the 1st time %s\n", annot.objects[0].obj_name); // here it can be seen as 'dog'

    for (int i = 0; i < 3; i++)
    {
        printf("%s\n", annot.objects[i].obj_name); // oth one disappear
        printf("%d\n", annot.objects[i].x_min);
        printf("%d\n", annot.objects[i].y_min);
        printf("%d\n", annot.objects[i].x_max);
        printf("%d\n", annot.objects[i].y_max);
    };
    printf("0th object name for the 2nd time %s\n", annot.objects[0].obj_name); //here it disappear
};

void readAnnotation(char *fileName, Annotation *annot)
{
    FILE *fp;
    fp = fopen(fileName, "r");
    if (fp == NULL)
    {
        printf("\nError: Cannot open file");
        exit(1);
    };

    fscanf(fp, "%s", annot->img_name);
    fscanf(fp, "%d", &(annot->width));
    fscanf(fp, "%d", &(annot->height));
    fscanf(fp, "%d", &(annot->num_obj));

    for (int i = 0; i < annot->num_obj; i++)
    {
        fscanf(fp, "%s", annot->objects[i].obj_name);
        fscanf(fp, "%d", &(annot->objects[i].x_min));
        fscanf(fp, "%d", &(annot->objects[i].y_min));
        fscanf(fp, "%d", &(annot->objects[i].x_max));
        fscanf(fp, "%d", &(annot->objects[i].y_max));
    };

    fclose(fp);
};

当我运行代码时,在main()函数中编写的for循环内使annot.objects [0] .obj_name消失。 当我在for循环之前对其进行检查时,该值可以视为“ dog”。但是在for循环内和for循环之后,该值消失了。 谁能告诉我代码的问题,并给我正确的答案以解决此问题。