I can do this double T[2][3] = { {1,3,4},{7,8,9}}; but not this double T[2][3]; T = { { a,b,c} , {d,e,f} } Why is that? Will I have to assign T[?][?] 6 times to do this? any better ways to do this assignment? Thanks, --j
Initializing Multidimensional Arrays You can also initialize multidimensional arrays. You assign the list of values to array elements in order, with the last array subscript changing while each of the former hold steady. Therefore, if you have the following array, the first three elements go into theArray[0]; the next three into theArray[1]; and so on: int theArray[5][3]; You initialize this array by writing int theArray[5][3] = { 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 }; 11 For the sake of clarity, you could group the initializations with braces, as in the following example: int theArray[5][3] = { {1,2,3}, {4,5,6}, {7,8,9}, {10,11,12}, {13,14,15} }; The compiler ignores the inner braces, which make it easier to understand how the numbers are distributed. Each value must be separated by a comma, without regard to the braces. The entire initialization set must be within braces, and it must end with a semicolon. Listing 11.5 creates a two-dimensional array. The first dimension is the set of numbers from 0 to 5. The second dimension consists of the double of each value in the first dimension. or VECTORS
I never reply while browsing forums but I'm already pissed off. C'MON people... start THINKINGe! 99% of your ANSWERS is just a junk, nothing more!!! hl2mods.info - go to hell, your post is shit and spam. Read the first post once more. He asked how to assign multiple values at once to multi-dimensional array AFTER creating it. learn to use your brain, all of you. peace Ahh and I dont care about post's date. If even 1 person starts using his brain after reading this, it's a success.
Dear Sir, There some people who at least try to help. But you are not helping. More over, you are inspiring him not to help again. If you thing hl2mods.info is wrong answer the right one or just go to hell and dont bother those people. This site needs people who want to answer. This site definitly do not need those people who think they know but wont answer. so please just go to hell live with satan and never come back
initializing a multi dimensional array coercing maybe wow seems a very interesting conundrum ... and i thought i had it bad with multi-dimensional hashes ... just curious but why do you want to do this for anyway?
if a b c d are variables then that assignment should work else if you were trying to assign characters then you need '' for single characters and "" for string however for strings you would need a different data type and a different means of initilising so 'a' will initialise the array with the numerical value associated with a, there are no letters in computing only numbers 0 and 1 ps the cake is a lie
Everyone please stop fighting !!! we are all here to help!!! The reason why you are not getting is that double is meant only for long integers and not characters!!! if you want to initialize characters then do the following: char T[2][3]={{a,b,c},{d,e,f}}; Now it will work perfectly!!!! Hope this helped you!!!