Skip to content
MPGHThe Dark Arts
/
RegisterLog in
Forum
Community
What's NewLatest posts across the boardTrendingHottest threads right nowSubscribedThreads you follow
Discussion
GeneralIntroductionsEntertainmentDebate FortFlaming & Rage
Board
News & AnnouncementsMPGH TimesSuggestions & HelpGiveaways
More Sections
Art & Graphic DesignProgrammingHackingCryptocurrency
Hacks & Cheats
Games
ValorantCS2 / CS:GOCall of Duty / WarzoneFortniteApex LegendsEscape From Tarkov
+14 moreLeague of LegendsGTA VMinecraftRustROTMGBattlefieldTroveBattleOnCombat ArmsCrossFireBlackshotRuneScapeDayZDead by Daylight
Resources
Game Hacking TutorialsReverse EngineeringGeneral Game HackingAnti-CheatConsole Game Hacking
Tools
Game Hacking ToolsTrainers & CheatsHack/Release NewsNew
Submit a release →Share your cheat, tool, or config with the community.
AINEW
AI Tools
General & DiscussionPrompt EngineeringLLM JailbreaksHotAI Agents & AutomationLocal / Open Models
AI × Gaming
AI Aimbots & VisionML Anti-CheatGame Bots & Automation
Create
AI Coding / Vibe CodingAI Art & MediaAI Voice & TTS
The AI frontier →Where game hacking meets modern machine learning. Jump in.
Marketplace
Buy & Sell
SellingBuyingTradingUser Services
Trust & Safety
Middleman LoungeMarketplace TalkVouch Copy Profiles
Money
Cryptocurrency TalkCurrency ExchangeWork & Job Offers
Start selling →List accounts, services, and goods. Use the middleman to trade safe.
MPGH The Dark Arts

A community for offensive security research, reverse engineering, and AI.

Community

ForumMarketplaceSearch

Account

RegisterLog in

Legal

Privacy PolicyForum RulesHelp & FAQ
© 2026 MPGH · All rights reserved.Built by the community, for the community. For educational purposes onlyContent is shared for security research and education — we don't condone illegal use. You're responsible for complying with applicable laws. Use at your own risk.
Home › Forum › Programming › C++/C Programming › [Question] NULL pointers...

[Question] NULL pointers...

Posts 1–6 of 6 · Page 1 of 1
MO
Mookamoka
[Question] NULL pointers...
So i learned about pointers a while back, and i figured since i was concentrating on rereading tutorials before i learn windows API and go ahead and tackle a 1500 page book i would look over them again, seeing as they're essential for hacking.

I came across null pointers, and they were explained in 4 lines. I know that in order to create a pointer that basically points to nothing you just make the value of the address its pointing to 0 (int *ptr = 0 or use the NULL keyword, which i didnt bother to learn how to use.

The tutorial also said that null pointers are useful in many situations, although i'm not quite sure when they would be used...

so my question isn't necessarily about how to incorporate null pointers in my code, but where i would use them... like in what situation would i need to make pointers that point to nothing....?

thanks :x
#1 · 15y ago
master131
[MPGH]master131
After deleting a pointer that was created using the 'new' keyword you should set it's value to NULL otherwise if you delete it again somewhere else in the code, anything could happen. This is called undefined behaviour. Also, when initializing pointers you should assign it to a NULL value if you are not using it straight away.

Quote from C++ Primer:
After deleting a pointer, the pointer becomes what is referred to as a dangling pointer. A dangling pointer is one that refers to memory that once held an object but does so no longer. A dangling pointer can be the source of program errors that are difficult to detect.

Setting the pointer to 0 (or NULL) after the object it refers to has been deleted makes it clear that the pointer points to no object.
#2 · edited 15y ago · 15y ago
MO
Mookamoka
Quote Originally Posted by master131 View Post
After deleting a pointer that was created using the 'new' keyword you should set it's value to NULL otherwise if you delete it again somewhere else in the code, anything could happen. This is called undefined behaviour. Also, when initializing pointers you should assign it to a NULL value if you are not using it straight away.

Quote from C++ Primer:
Thaaaanks!!

this brings me to my next question :3

in what kind of situation would i need to delete a pointer? and you do so by using delete *ptr if ptr is the pointer name.... after using say, int *ptr = new whatever right?
#3 · 15y ago
WH
whit
Quote Originally Posted by Mookamoka View Post
Thaaaanks!!

this brings me to my next question :3

in what kind of situation would i need to delete a pointer? and you do so by using delete *ptr if ptr is the pointer name.... after using say, int *ptr = new whatever right?
Well if you accolate it in heap memory using the "new" identifier then your going to have to deaccolate it using delete as it wont be destoyed after the scope ends
#4 · 15y ago
MO
Mookamoka
Quote Originally Posted by whit View Post


Well if you accolate it in heap memory using the "new" identifier then your going to have to deaccolate it using delete as it wont be destoyed after the scope ends
So if i used a pointer called ptr1 in a function, i would use the delete keyword to "delete" ptr1 and make it a dangling pointer and reuse it in another function if i wanted to save memory?
#5 · 15y ago
'Bruno
'Bruno
malloc/new for allocation
free()/delete for deallocation

actually most of the times you clear pointers just to be sure that you don't create memory leaks with your application. not that it is really necessary.

And a pointer is something that points to a memory location, so... it's just a pointer. The problem is in what is was pointing at.

Let's say you have the pointer pointed at some place on memory and placed a string in there. If you point it to null without clearing memory first, you are creating a memory leak. With this i mean, you are actually leaving the string in memory, just not pointing to it. That's why you should always clear the memory after using the pointer for something else, or after finishing using it.

(after the application close, windows will clear the memory, but still, get used to it)

Edit: Just saw that master posted pretty much this.. Sorry >_<
#6 · edited 15y ago · 15y ago
Posts 1–6 of 6 · Page 1 of 1

Post a Reply

Tags for this Thread

None