how do i make a 3 Dimentional string Array in miracle c?
i want to store 3 lists of names:
eg
bob,fred,jeff
sid,paul,carl
|
|
V
ETC....
thankz for the help peoplez...
how do i make a 3 Dimentional string Array in miracle c?
i want to store 3 lists of names:
eg
bob,fred,jeff
sid,paul,carl
|
|
V
ETC....
thankz for the help peoplez...
Shizzle Ma 'C' Whizzle's
Haven't used Miracle C, but if it like 'standard' C, then this should work:
Code:#define NrOfTriples 2 #define MaxLengthOfOneString 32 char StringArray[NrOfTriples][3][MaxLengthOfOneString]; strcpy(StringArray[0][0], "Bob"); strcpy(StringArray[0][1], "Fred"); strcpy(StringArray[0][2], "Jeff"); strcpy(StringArray[1][0], "Sid"); strcpy(StringArray[1][1], "Paul"); strcpy(StringArray[1][2], "Carl");
MagosX.com
Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime.
Thankz works sound
<code>
for(i=0;i<2;i++)
{
printf("\n");
for(j=0;j<3;j++)
{
printf("%s\t\t",StringArray[i][j]);
}
}
<\code>
i hav another prob wiv this line of code tho :S
i get this error message
arraytest.c: line 24: wrong # args in function call
'{ printf("%s\t\t",StringArray[i][j])'
aborting compile
Shizzle Ma 'C' Whizzle's
o yeah, Silly me, i think ive lost my brain today lol
Shizzle Ma 'C' Whizzle's