Resizing a char[x] to char[y] at runtime

后端 未结 11 1117
我在风中等你
我在风中等你 2021-02-11 01:33

OK, I hope I explain this one correctly. I have a struct:

typedef struct _MyData
{
   char Data[256];
   int  Index;
} MyData;

Now, I run into

11条回答
  •  心在旅途
    2021-02-11 02:04

    The problem here is your statement "I can't use a pointer". You will have to, and it will make everything much easier. Hey, realloc even copies your existing data, what do you want more?

    So why do you think you can't use a pointer? Better try to fix that.

提交回复
热议问题