Originally posted by Earth_King
Opse! I did not see that Feat1 or Feat2 are array constants.
Since Feat1 is name of char array and Feat1 is constant; so
you are not able to modify after it initialize.
It not allow to modifyh Feat1 = (char) p;
Feat1 is always allow on the righthand assignment (RH value).
Earth_King
That would hold true if the array constants were also the names of the variables I was trying to pass to, but here:
Code:
#include <iostream.h>
#include <cstdlib>
#include <time.h>
void acgen();
void hpgen();
void CHRgen();
void CONgen();
void DEXgen();
void INTgen();
void STRgen();
void WISgen();
void feats();
void traits();
void features();
void spells();
void special();
int AC;
int HP;
int CHR;
int CON;
int DEX;
int INT;
int STR;
int WIS;
char Name[50];
char Feat1;
char Feat2;
char Feat3;
char Feat4;
char Feat5;
char Trait1;
char Trait2;
char Trait3;
char Trait4;
char Trait5;
char Features;
char Spells;
char Special;
In other words, what I am trying to pass to are just more char type variables, not the arrays themselves.
Also, in main() you'll see what I mean...
Code:
void main()
{
char x;
cout << "What is the Monster Name? ";
cin >> Name;
cout << endl;
acgen();
cout << "AC: " << AC << endl;
hpgen();
cout << "HP: " << HP << endl;
CHRgen();
cout << "CHR: " << CHR << endl;
CONgen();
cout << "CON: " << CON << endl;
DEXgen();
cout << "DEX: " << DEX << endl;
INTgen();
cout << "INT: " << INT << endl;
STRgen();
cout << "STR: " << STR << endl;
WISgen();
cout << "WIS: " << WIS << endl;
feats();
cout << "Feats: " << Feat1 << " " << Feat2 << " " << Feat3 << " " << Feat4 << " " << Feat5 << endl;
traits();
cout << "Traits: " << Trait1 << Trait2 << Trait3 << Trait4 << Trait5 << endl;
features();
spells();
special();
cout << "\n\nHit q to quit: ";
cin >> x;
return;
}
Does that make a bit more sense?
Trying to pass a string from an array (feat1) to a pointer (pf1) to a char global (Feat1).