Why do you need the variable ii? You can take care of that when you assign your pointers. I'm not sure what the compiler would generate for your code, but i expect your code can be simplified so it would be easier to read and execute.