0

Why does assignment work if I use an array as a struct member but is not permitted if used in isolation?

struct Foo{
    int arr[2]{100, 1000};
};

int main(){

    Foo a{};
    Foo b{2, 20};
    a = b; 
    // works
    
    int da[2];
    int db[2];
    da = db;
    // error
}
CD86
  • 979
  • 10
  • 27

0 Answers0