I am stuck on a certain point in making a program. That would be using pointers to pull diffrent strings from an array, while still being interchangable with a "char" type.
For example..
I have absolutely no idea how to make this accept the pointer's value. Any help would be greatly appriacated..Code:void feats() { int x; char feat1[] = "Alertness"; char feat2[] = "Ambidexterity"; char feat3[] = "Armor Proficency(small)"; char feat4[] = "Armor Proficency(medium)"; char feat5[] = "Armor Proficency(large)"; void *pf1 = feat1; void *pf2 = feat2; void *pf3 = feat3; void *pf4 = feat4; void *pf5 = feat5; srand(time(NULL)); x = rand()%5; if(x == 1) { Feat1 = pf1; } else if(x == 2) { Feat1 = pf2; } else if(x == 3) { Feat1 = pf3; } else if(x == 4) { Feat1 = pf4; } else { Feat1 = pf5; } return; }



LinkBack URL
About LinkBacks


