, 그래서구조체의 구조체를 할당하는 방법은 무엇입니까? 그래서
#include <stdio.h>
#include <string.h>
struct
{
int n, o, p;
struct
{
int a, b, c;
}Str2;
}Str1;
main()
{
struct Str1.Str2 *x (Str1.Str2*)malloc(sizeof(struct Str1.Str2*));
x->a = 10;
}
... 내가 .. 다른 구조체의 내부 구조체를 가지고 내가 그 구조체의 malloc 수있는 방법을 알고 whant, 나는이 작동하지 않는 것을 시도하지만 .. 어떻게 이것을 만들 수 있습니까, 아니면 더 나은 모든 구조체를 할당 할 수 있습니까? 당신이 원하는대로 그럼 당신은 개별적으로 할당 할 수
typedef struct
{
int a, b, c;
}Str2;
typedef struct
{
int n, o, p;
Str2 s2;
}Str1;
: 같은 일을 선언하지 왜
Ooook, 및이를 사용하는 ?? .. 구조체 (PS)와 복수의 랜덤 * X = (구조체 (PS)와 복수의 랜덤 *)의 malloc (sizeof 연산자 (구조체 (PS)와 복수의 랜덤 *)). 그리고 X-> s2.a = 10? – Alexandre