Mail Archives: djgpp/2000/01/22/22:59:58
Im so really stuck.i want to make a name generator. but my output wont produce
anything. and im getting callback error messages.
#include <stdlib.h>
#include <stdio.h>
int rnd(int range);
void seedrnd(void);
char get_character_name(char *string);
char *pri[17]; /* is there any way to declaire a variable with a randomized
setting
i don't want it to always be at this number */
int main()
{
seedrnd();
get_character_name(*pri);
printf("%s",*pri);
}
int rnd(int range)
{
int r;
r=rand()%range;
return(r);
}
void seedrnd(void)
{
srand((unsigned)time(NULL));
}
char get_character_name(char *string)
{
char *g_name_size[16];
char z[] = {65,69,73,79,85};
char a,b;
int h,t,w;
a=0;
b=0;
for(h=1;h<4;h++)
{
for(t=1;t<16;t++)
{
start1:
a=65+(rnd(25)+1);
w=rnd(1);
if(w<.7 && a==69 || a==73 || a==79 || a==85)
goto start1;
if(t==2 || t==5 || t==7)
b=z[rnd(4)+1];
if(b!=0)
g_name_size[t] = b;
}
g_name_size[t] = a;
}
*string = *g_name_size[t];
return(*string);
}
i got it to exit at 0x0000 but when i ran the .exe the screen filkered and then
the window cloesed :(
im almost bald any help would be most appreciated.
- Raw text -