This is the code I saw in mock paper.
What is the difference between class & struct?Code:struct Ant { int age, strength; }; int n; cin >> n; Ant *AntArmy; AntArmy = new Ant[n];//can't get why the structure name can be the array name AntArmy[0].age=1; AntArmy[0].strength=5;
Why is the structure name used as the array name?
What 's going on with AntArmy = new Ant[n];?
Thanks in advance!