LINUX.ORG.RU

История изменений

Исправление int13h, (текущая версия) :

#include <stdio.h>

typedef struct{

	char s[200];
	int a,b,c;
    float ds;
    
} str1_t;

typedef struct{

	char *s;
	int a,b,c;
    float ds;
    
} str2_t;


int main(int argc, char **argv)
{
	
	printf("%d\n",sizeof(str1_t));
	printf("%d",sizeof(str2_t));
	return 0;
}

Экономия от необъявления количества элементов массива s дает экономию

s - str1_t - str2_t
байт, так?

Исходная версия int13h, :

#include <stdio.h>

typedef struct{

	char s[200];
	int a,b,c;
    float ds;
    
} str1_t;

typedef struct{

	char *s;
	int a,b,c;
    float ds;
    
} str2_t;


int main(int argc, char **argv)
{
	
	printf("%d\n",sizeof(str1_t));
	printf("%d",sizeof(str2_t));
	return 0;
}

Экономия от необъявления количества элементов массива s дает экономию s - str1_t - str2_t байт, так?