Re: Working with pointers/adresses

2020-07-09 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Jul 09, 2020 at 05:24:33PM +, matheus via Digitalmars-d-learn wrote: [...] > I wonder if the question was more like intended to display the value > using pointers, ie: > > import std.stdio; > > void main(){ > int i; > readf("%d\n", i); > int *p = > writeln(*p); > } >

Re: Working with pointers/adresses

2020-07-09 Thread matheus via Digitalmars-d-learn
On Thursday, 9 July 2020 at 17:24:33 UTC, matheus wrote: On Wednesday, 8 July 2020 at 20:33:39 UTC, Paul Backus wrote: import std.stdio; void main() { int i; readf("%d\n", i); // read a number ubyte* p = cast(ubyte*) i; // convert it to a pointer writeln(*p); // write the data

Re: Working with pointers/adresses

2020-07-09 Thread matheus via Digitalmars-d-learn
On Wednesday, 8 July 2020 at 20:33:39 UTC, Paul Backus wrote: import std.stdio; void main() { int i; readf("%d\n", i); // read a number ubyte* p = cast(ubyte*) i; // convert it to a pointer writeln(*p); // write the data at that address to the console } Note that this program

Re: Working with pointers/adresses

2020-07-09 Thread Paul Backus via Digitalmars-d-learn
On Thursday, 9 July 2020 at 16:16:53 UTC, Quantium wrote: I have one more question. I tested the programm, as you said, it worked rarely because of OS restrictions. If I compile that code to dll, and run it through dll launcher, should it work? The OS restrictions don't care whether your

Re: Working with pointers/adresses

2020-07-09 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Jul 09, 2020 at 04:16:53PM +, Quantium via Digitalmars-d-learn wrote: > I have one more question. I tested the programm, as you said, it > worked rarely because of OS restrictions. If I compile that code to > dll, and run it through dll launcher, should it work? No, it's subject to

Re: Working with pointers/adresses

2020-07-09 Thread Quantium via Digitalmars-d-learn
I have one more question. I tested the programm, as you said, it worked rarely because of OS restrictions. If I compile that code to dll, and run it through dll launcher, should it work?

Re: Working with pointers/adresses

2020-07-08 Thread Paul Backus via Digitalmars-d-learn
On Wednesday, 8 July 2020 at 19:48:07 UTC, Quantium wrote: I'm learning now memory usage in D, and I have the problem that I can't solve. The problem is (The third step): 1) Programm gets number (In int format) as input data. 2) Integer is converted to HEX 3) Programm gets the data in 0x

Working with pointers/adresses

2020-07-08 Thread Quantium via Digitalmars-d-learn
I'm learning now memory usage in D, and I have the problem that I can't solve. The problem is (The third step): 1) Programm gets number (In int format) as input data. 2) Integer is converted to HEX 3) Programm gets the data in 0x memory slot and writes it in the console.