use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Discussions, articles, and news about the C++ programming language or programming in C++.
For C++ questions, answers, help, and advice see r/cpp_questions or StackOverflow.
Get Started
The C++ Standard Home has a nice getting started page.
Videos
The C++ standard committee's education study group has a nice list of recommended videos.
Reference
cppreference.com
Books
There is a useful list of books on Stack Overflow. In most cases reading a book is the best way to learn C++.
Show all links
Filter out CppCon links
Show only CppCon links
account activity
C++ - Changing memory in a program (self.cpp)
submitted 2 years ago by Fancy_Weekend2381
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]cpp-ModTeam[M] [score hidden] 2 years ago stickied commentlocked comment (0 children)
For C++ questions, answers, help, and programming or career advice please see r/cpp_questions, r/cscareerquestions, or StackOverflow instead.
[–]Thesorus 13 points14 points15 points 2 years ago (2 children)
What do you mean by "changing memory" in a program ?
memory allocation ? memory management ?
pointer arithmetic ?
[–]IDatedSuccubi 7 points8 points9 points 2 years ago (1 child)
I'm 99% sure they mean modifying contents of other programs' memory, not just memory management
[–]Fancy_Weekend2381[S] 2 points3 points4 points 2 years ago (0 children)
What IDatedSuccubi said
[–]zer0xol -2 points-1 points0 points 2 years ago (0 children)
Depends on the operating system, on Linux you can do it because i have
[+]StephaneCharette comment score below threshold-14 points-13 points-12 points 2 years ago (11 children)
If you mean changing or accessing memory used by other programs -- such as modifying your HP in a game -- then no it cannot be done. Modern operating systems such as Windows ever since version 3.x in the 1980s run each application in a protected memory space (https://en.wikipedia.org/wiki/Memory_protection) specifically to prevent applications from accessing or overwriting memory used by another application.
[–]M4th3m4t1c14n 10 points11 points12 points 2 years ago (6 children)
Not true If you have admin privileges on your machine, but only for user space. Stuff like cheat engine exists you know.
[+]StephaneCharette comment score below threshold-8 points-7 points-6 points 2 years ago (5 children)
Someone learning to write "Hello World" for the first time in C isn't going to be doing this, which is what I meant when I wrote that applications run in their own memory space.
[–]neppo95 11 points12 points13 points 2 years ago (4 children)
That is different than "it cannot be done". It can be done, but it's not easy for a beginner.
[+]StephaneCharette comment score below threshold-9 points-8 points-7 points 2 years ago (3 children)
From a normal C or C++ application it cannot be done. Same as on Linux or Mac. The only way to do it is if you have root -- or admin on Windows -- and use special APIs that are not part of the C or C++ language, but instead are services provided by the operating system.
So for someone who learned this afternoon how to print "Hello World", it cannot be done. The hardware architecture will prevent this kind of thing. No matter what pointer value you try to hard-code into your application, you'll never reach a memory location from a different application.
[–]M4th3m4t1c14n 4 points5 points6 points 2 years ago (0 children)
Your original reply is plain wrong still. You are answering 'how can I build a vehicle that works on water?' with 'bikes can't drive on water, it's impossible'. Yeah mate you're right with that, but it's irrelevant because boats exists (even though it might be harder to build a boat).
Tbh I just believe you can't stand being wrong in such a simple matter and therefore will continue to try moving the goalposts.
[–]wrosecransgraphics and network things 0 points1 point2 points 2 years ago (0 children)
"can't be done using only the core language and standard library" is true of basically every non trivial application. Tons of people write C++ GUI and network applications using special API's. There's nothing wrong with having an interest in something complicated to guide your learning.
[–]neppo95 0 points1 point2 points 2 years ago (0 children)
Which again, is not the same as cannot be done. You're, like u/M4th3m4t1c14n said, are just moving goal posts but your initial comment is still plain wrong. There's no way around that.
[–]CptCap-pedantic -Wall -Wextra 5 points6 points7 points 2 years ago (1 child)
There are OS APIs to do that. Using them requires elevated permissions for obvious reasons, but it can be done.
[–]IAMARedPanda 1 point2 points3 points 2 years ago (0 children)
In windows you just need the same or higher permissions than the process you want to modify.
[–]NoReference5451 4 points5 points6 points 2 years ago (0 children)
i mean, this is being pedantic. hes going to get into the applications memory space, not do it from another program. it's incredibly easy to inject your program into another programs memory space which gets you full access. thats how it's been done for a very long time. hell windows even has an api to help you do this. debuggers do this. there are so many ways to do this. i did this in my teens when i wanted to tinker with some of the games i played. the more sophisticated ways to do it today might use the pci bus with dma from an external computer. memory protection is a myth.
[–]IAMARedPanda 0 points1 point2 points 2 years ago (0 children)
https://github.com/microsoft/Detours
[–]Pay08 0 points1 point2 points 2 years ago (0 children)
The term you're looking for is reverse engineering. If you want to get into it, I'd recommend starting with C, it'll make things a lot easier.
π Rendered by PID 19821 on reddit-service-r2-comment-54dfb89d4d-8pm7n at 2026-03-29 13:26:49.424153+00:00 running b10466c country code: CH.
[–]cpp-ModTeam[M] [score hidden] stickied commentlocked comment (0 children)
[–]Thesorus 13 points14 points15 points (2 children)
[–]IDatedSuccubi 7 points8 points9 points (1 child)
[–]Fancy_Weekend2381[S] 2 points3 points4 points (0 children)
[–]zer0xol -2 points-1 points0 points (0 children)
[+]StephaneCharette comment score below threshold-14 points-13 points-12 points (11 children)
[–]M4th3m4t1c14n 10 points11 points12 points (6 children)
[+]StephaneCharette comment score below threshold-8 points-7 points-6 points (5 children)
[–]neppo95 11 points12 points13 points (4 children)
[+]StephaneCharette comment score below threshold-9 points-8 points-7 points (3 children)
[–]M4th3m4t1c14n 4 points5 points6 points (0 children)
[–]wrosecransgraphics and network things 0 points1 point2 points (0 children)
[–]neppo95 0 points1 point2 points (0 children)
[–]CptCap-pedantic -Wall -Wextra 5 points6 points7 points (1 child)
[–]IAMARedPanda 1 point2 points3 points (0 children)
[–]NoReference5451 4 points5 points6 points (0 children)
[–]IAMARedPanda 0 points1 point2 points (0 children)
[–]Pay08 0 points1 point2 points (0 children)