Are you sure you want to do this? It seems that you are wanting to do something very advanced and dangerous and are having a very basic doubt. This combination doesn’t usually work.
Does the application have write permission in this area of memory? Luckily the operating system controls this and thankfully it does not let the application write anywhere in the memory. You cannot write in other applications and not even in certain parts of your own application.
The variables used were correctly arrows? I will consider that yes, after all you did not put all part of the program and should consider that there is a problem just on this line.
So just read one whole and use it as pointer as you were already trying to do. Probably the problem is that you were reading a string.
int endereco;
scanf("%d", &endereco);
int isSuccessful = WriteProcessMemory(hproc, (LPVOID)endereco, &NewValue, (DWORD)sizeof(NewValue), NULL);
I put in the Github for future reference.
Take a look at [tour]. You can accept an answer if it solved your problem. You can vote on every post on the site as well. Did any help you more? You need something to be improved?
– Maniero