![]() |
|
#1
|
|||
|
|||
About variables in CI'm just starting with C, and I'm wondering if C has a feature I love to use in PHP. In PHP, you can use what they call variable variables where you can dynamically use variables, like in this loop:
for($i; $i<$some_number; $i++) { $var{$i}='some string here'; } So does C have something like this? Thanks in advance. ![]() |
|
#2
|
|||
|
|||
|
hello, actually c or c++ dont have the variable variable names feature...
you always have to create a variable name when you are coding, the program dont create it at runtime like that feature... i was looking if that was possible too in a previous post but that feature isnt implemented... but if you want that for something like in the example you show you can use an array and call it almost the same: CPP / C++ / C Code:
hope this helps... |
|
#3
|
|||
|
|||
|
No that's not quite the meaning in PHP. The curly brackets around the $i mean the value of $i is appended to the name $var. So it cycles over $var0, $var1, etc...
I know of no way of doing this in C++. It's a syntactic sugar of PHP. GF |
|
#4
|
|||
|
|||
|
Quote:
but that only if he wanna make something like his sample code... because other useful implementations of variable variable names arent possible since c or c++ dont support them... |
Recent GIDBlog
Toyota - 2008 September Promotion by Nihal
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| passing variables out of an iframe by url | JUNK KED | MySQL / PHP Forum | 5 | 31-Jul-2007 09:33 |
| getting variables from $_GET & $_POST | Dunc | MySQL / PHP Forum | 2 | 29-Mar-2004 05:45 |
| Apache on Windows XP and passing variables | Jos Elkink | Apache Web Server Forum | 4 | 21-Nov-2003 02:21 |
| PHP variables | nniehoff | MySQL / PHP Forum | 7 | 26-Jul-2002 06:25 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The