i have assigned a value directly to a pointer like *ptr=12; and i have used it,no error came.if we assign like this where the pointer points to?explain me?
smdjilani 0
js
Recommended Answers
Jump to PostAre you doing this in an initialization context? Because if you do something like the following declaration:
int *ptr = 12;
It probably will not error, but instead make
ptr
point to the (probably invalid) memory location of 12. Otherwise, I'm absolutely baffled that no …
Jump to PostTo add to what has been said, I see this most commonly when writing code for embedded hardware, in which some physical real world sensor or signaller is permanently linked to a specific memory address. For example, if you look in the manual for your embedded hardware and see that …
All 6 Replies
Tumlee 42
Junior Poster in Training
deceptikon 1,790
Code Sniper Team Colleague Featured Poster
Tumlee 42
Junior Poster in Training
deceptikon 1,790
Code Sniper Team Colleague Featured Poster
Moschops 683
Practically a Master Poster Featured Poster
Ancient Dragon 5,243
Achieved Level 70 Team Colleague Featured Poster
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.