Indirect access to variables.

DLearner bmqazwsx123 at gmail.com
Fri Dec 29 17:11:49 UTC 2023


Compile-time:

Is there a 'foo1' that yields 1 from the snippet below?
```
void main() {

    import std.stdio;
    size_t var1 = 1;

    char[4] Txt = cast(char[4])("var1");
    writeln(foo1(Txt));
}
```

Similarly, execution-time, is there a foo2 that wields 2 from the 
snippet below:

```
void main() {

    import std.stdio;
    size_t var2 = 2;

    char[4] Txt;

// Txt = various things at run-time;
// But finally:
    Txt = cast(char[4])("var2");
    writeln(foo2(Txt));
}

```


More information about the Digitalmars-d-learn mailing list