#include<iostream>
#include<string>
using namespace std;
int main(void) {
struct STRCT {
int num;
string str1,
arrStr1[],
str2,
arrStr2[];
};
int a;
string b[2],
c[3],
d,
e;
a = 10;
b[0] = "hello";
b[1] = "world";
c[0] = "stack";
c[1] = "over";
c[2] = "flow";
d = "random";
e = "text";
//how do i intialize the arrays (arrStr1[] and arrStr2[]) in aStruct along with the rest of items?
//is it like this?
//i want aStruct[] to be an array and i want its size to be declared from the start to later be filled with vals
STRCT aStruct[2];
//then later in the program i want to assign aStruct[] vals
aStruct[0] = {a, //int
d, //string
{b}, //string[]
e, //string
{c}}; //string[]
}
기본적으로 구조체 배열을 내부에 배열로 만든 다음 올바른 값을 가져 와서 구조체 배열 내부의 배열에 적절한 값을 할당하려고합니다. C에서 도움구조체 내의 문자열 배열 초기화
답장을 보내 주셔서 감사합니다. 다음 주에 배울 때 곧 벡터를 사용할 것입니다. 그래서 직접적으로 arrStr1을 채울 수있는 방법이 없습니다. – Tech
접근 방식을 시도 했습니까? 작동합니까? – Jeeva
컴파일러가 "expect; before {"오류가 발생했습니다 – Tech