How would I make a program that searches for a number in memory (for example a hiscore in a game) and then displays it memory address and then asks what one you want to edit.
Then after selecting that one, you enter the new value for which you want it to change to. I have written this so far but I do not know how to use pointers:
Code:
#include <stdio.h>
void changemem(int);
int main()
{
int mem;
char choice;
int newmem;
printf("Enter a value you are searching for: ");
scanf("%d", &mem);
printf("%d\t%p\n", mem, mem);
printf("\n\nWould you like to enter a new value for %p? ", mem);
fflush(0);
choice = getchar();
choice = getchar();
switch (choice)
{
case 'y':
case 'Y':
changemem(mem);
break;
case 'n':
case 'N':
break;
case '\n':
case '\b':
case '\t':
main();
default:
printf("\nInvalid Choice!\n");
main();
}
return 0;
}
void changemem(int x)
{
printf("Enter the new value: ");
scanf("%p", &x);
printf("\n\nValue changed!\n");
printf("%d\t%p\n", x, x);
main();
}