据ftell称,我的文本文件的大小为25个字节。但是,当我使用ftell作为char数组的大小时,sizeof给了我200。

本质上,这是我的问题。

@media (max-width: 767.98px) {
  .my-custom-color {
    color: blue;
    text-align: center;
  } 
}

当ftell返回的int为20时,为什么sizeof(output_string)给我200?

shuojie 回答:据ftell称,我的文本文件的大小为25个字节。但是,当我使用ftell作为char数组的大小时,sizeof给了我200。

char *output_string[size];

这是指针数组,如果您在64位计算机上运行, 一个指针是64位,即8个字节。 如果尺寸为25,则:

sizeof(output_string) = 25 * sizeof(char *) = 25 * 8 = 200
,

对不起我。

我不小心在数组声明中写了*,这使output_string成为了一个指针数组,而不是chars

本文链接:https://www.f2er.com/3053879.html

大家都在问