|
-
Jan 18th, 2006, 02:17 PM
#1
Thread Starter
Frenzied Member
why does this give me too many initialisers error?
char names[] = { "Mary", "Jordan" };
i want to also store a string value for each name too, how can i do this guys?
like.. Mary - female
Jordan female etc
so i want to store male or female for each person in the array
-
Jan 18th, 2006, 02:27 PM
#2
Re: why does this give me too many initialisers error?
because names is a char array in your program and while initialising, you are passing 2-d array items.
if you make it 2-d array, then it will not give error.
example: char *names[] (or you can use char names[][25] - in this you need to specify the second index)
so Mary will be names[0][3], Jordan will be names[1][5].
hope you get it now.
-
Jan 18th, 2006, 02:31 PM
#3
Re: why does this give me too many initialisers error?
and how are you determining about the gender? will the user enter it?
-
Jan 18th, 2006, 04:06 PM
#4
Thread Starter
Frenzied Member
Re: why does this give me too many initialisers error?
well im passing information to the dll from my client mIRC, e.g..
//echo -a $dll(Test32.dll, TestFunction,0) echos
Gupta
heres the code..
Code:
extern "C" int WINAPI TestFunction(HWND, HWND, char *data, char *parms, BOOL, BOOL) {
char *names[] = { "Harsh", "Gupta", "pouncer" };
_fstrcpy( data , names[1] );
return 3;
}
but now im going to pass a full parameter to the dll like this
/dll Test32.dll TestFunction Harsh-Male
and i want it to store Harsh in 1 part of the array, and male in another and then somehow be able to get the gender of the person by their name
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|