![]() |
|
#1
|
|||
|
|||
2 D char ArrayHi All,
I want to rephrase my earlier question. Actually what I am looking for is 2 dimensional char array. OR set of char arrays where the names of each array is ending the number of the array. i.e the ith array would be the ith row if we make it through 2 dimensional array. The point is that the ith number is not determined beforehand. It depends on the iteration and it could be any number. I tried it with 2 dimensional array but it doesnt work. Here is my code Quote: CPP / C++ / C Code:
When I run this code it gives the following error: Quote: error C2059: syntax error : ']' Any suggestion for both options? Last edited by dsmith : 20-Jul-2004 at 09:29.
|
|
#2
|
||||
|
||||
|
Hi gwk. Try using:
CPP / C++ / C Code:
I am not sure if this answers your full question or not to be honest. Your original question was asking if you could use dynamic variable names. The answer is no. So, if the 2-d char array can be used to solve your problem, then you are in good shape. If not, you may need to set up your own variable structure: CPP / C++ / C Code:
I may not be clear on your full question, if this doesn't help, please post again and let us know. Thanks. __________________
The best damn Sports Blog period. |
|
#3
|
||||
|
||||
|
Why on earth would need to use dynamic variable names in such a way to defeat the entire purpose of using arrays in the first place? I don't see why you would want to create a bunch of variables of the same type that have the same name except for a number on the end, when that's exactly what an array does!
__________________
-Aaron |
|
#4
|
||||
|
||||
|
Quote:
Without knowing exactly what gwk is doing, I agree with your statement Aaron. However, there may be something else that he is trying to do that I don't see, so I wanted to give him this option as well. You could actually turn that into a pretty efficient class that would allow user declared variables. I have done similar things before. __________________
The best damn Sports Blog period. |
Recent GIDBlog
Python ebook by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| 3D array dynamic memory allocation | cjwatchdog | C Programming Language | 3 | 20-Feb-2004 16:27 |
| throwing an struct(with an array) through a function | knakworstje | C Programming Language | 5 | 15-Feb-2004 17:20 |
| (read/write file) newbie need help plz | momotx | C Programming Language | 6 | 28-Jan-2004 14:40 |
| convert long to pointer to char | realpopeye | C++ Forum | 2 | 26-Sep-2003 11:22 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The