Hello, I'm not much of a programmer and will probably never be, but am just curious.
Can I initialize a pointer with a constant value different than NULL? I.e. can I tell my pointer to point at one particular memory cell? It's a number so why couldn't I? I know it would be of little use in normal programming, but I thought it could be could good while programming some devices with very little memory, where one would like to control every cell.
mmasny
0
Light Poster
Recommended Answers
Jump to PostYes you can do that.
But details do vary from one compiler to another (and the kind of machine you're running on).
Jump to PostYes. That's one of the main reasons for having pointers.
Jump to PostNow you're in the realm of "what the heck are you trying to do" type of question. Just loading a number into a pointer does not make it an address.
You load the pointer with an address, not an integer.
Explain what you are trying to accomplish, with enough detail …
All 9 Replies
Salem
5,138
Posting Sage
WaltP
2,905
Posting Sage w/ dash of thyme
Team Colleague
mmasny
0
Light Poster
WaltP
2,905
Posting Sage w/ dash of thyme
Team Colleague
mmasny
0
Light Poster
WaltP
2,905
Posting Sage w/ dash of thyme
Team Colleague
Narue
5,707
Bad Cop
Team Colleague
mmasny
0
Light Poster
Salem
5,138
Posting Sage
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.