Instead of using arrays (which are fairly limited) I will suggest to use vectors with constructors. Vectors are some kind of dynamic arrays.
See here:
http://www.cplusplus.com/reference/stl/vector/
And small code example:
#include "DarkGDK.h"
#include <vector>
using namespace std;
class cEnemy
{
public:
//=== CLASS CONSTRUCTOR ===
cEnemy(char* Name_c, int Xpos_c, int Ypos_c, int Life_c, int Damage_c);
//=== CLASS VARIABLES ===
char* Name;
int Xpos;
int Ypos;
int Life;
int Damage;
};
vector <cEnemy> Enemies;
int A, B, C;
//================================================================================================
//===== DARK GDK MAIN LOOP ========================================================================
//================================================================================================
void DarkGDK ( void )
{
//===== SCREEN SETTINGS =====
dbSyncOn ( );
dbSyncRate ( 60 );
dbSetDisplayMode(800, 600, 32);
while ( LoopGDK ( ) )
{
//=== CREATING NEW ENEMY ===
Enemies.push_back( cEnemy( "Name", 500, 500, 100, 50) );
//=== CREATING NEW 100 ENEMIES ===
for(int E = 1; E <= 100; E++)
{
Enemies.push_back( cEnemy( "Name", 500, 500, 100, 50) );
}
//=== READING AND WRITING SOME VALUES IN VECTOR ===
A = Enemies[0].Xpos;
B = Enemies[50].Life;
C = Enemies[75].Damage;
Enemies[33].Damage = 50;
//=== GOING THROUGH ALL ENEMIES AND E.G. CHECKING SOME VALUES ===
for(int E = 0; E < Enemies.size(); E++)
{
if( Enemies[E].Life == 0 )
{
// something... e.g. destroy enemy from vector
Enemies[ Enemies.begin() + E].erase(); //will delete that array/vector element and } // will move every other element so finally
} // size of vector will decrease
dbSync ( );
}
// return back to windows
return;
}
//================================================================================================
//===== END OF DARK GDK MAIN LOOP ================================================================
//================================================================================================
//=== CLASS CONSTRUCTOR ===
cEnemy::cEnemy(char* Name_c, int Xpos_c, int Ypos_c, int Life_c, int Damage_c)
{
Name = Name_c;
Xpos = Xpos_c;
Ypos = Ypos_c;
Life = Life_c;
Damage= Damage_c;
}
I wrote that code at work in notepad so i didn't have chance to check spelling etc. but general idea i guess it's ok.
I hope it's will help you, if you will have any other questions post it here.