The first thing you need to learn is that
int*
and
char*
are not the same: you cannot assume that a valid char pointer will give a valid int pointer - because int pointers must be on 2, 4, or 8 byte boundaries (depending on the size of an int in your system) while char pointers are single byte boundary. So an "odd" value in a char pointer will not reference the same memory location when treated as a int pointer - some of the least significant bits will be discarded or ignored. You need to be aware of that if you are changing the calling code as well.
Other than that,
Quote:
it still doesn't work
tells us nothing: we know there is a problem or you wouldn't be posting here.
Quote:
the main problem is coming from the getInteger function
Also tells us nothing because there is no such function in your code!
So, it's going to be up to you.
Fortunately, you have a tool available to you which will help you find out what is going on: the debugger. How you use it depends on your compiler system, but a quick Google for the name of your IDE and "debugger" should give you the info you need.
Put a breakpoint on the first line in the function, and run your code through the debugger. Then look at your code, and at your data and work out what should happen manually. Then single step each line checking that what you expected to happen is exactly what did. When it isn't, that's when you have a problem, and you can back-track (or run it again and look more closely) to find out why.
Sorry, but we can't do that for you - time for you to learn a new (and very, very useful) skill: debugging!