If I have class [5][20], how would I initialize it to have Boss, Manager, sales, ect on class[0][], class[1][] ..... respectively.
Printable View
If I have class [5][20], how would I initialize it to have Boss, Manager, sales, ect on class[0][], class[1][] ..... respectively.
If you write and post some code, we can help guide you through whatever problems you are seeing.
--
Mats
http://cboard.cprogramming.com/showthread.php?t=98576
On that post I have done the input thing correctly, sorting function is bad.
Oh sorry, yes it is a character array, class is just the name of it.
From your example, it looks like a user input, I want to go ahead and initialize the string to 5 different words.
char class[5][20]={ }. What goes in the brackets?
I am a beginner. I don't know what goes into the brackets. That's why I used a temp string and loops to access each element and put the characters in them ;)
I found what you are looking for:
http://www.learncpp.com/cpp-tutorial...sional-arrays/
The syntax would be:
Code:char class[5][20] = { "String1", "String2", etc };