As long as you are within the allocated range for your application, you can use pointers / address wherever you want. keep going far enough and you either destroy your program or fall into the edge of your allocated memory and get some kind of protection. Checking the execution time is expensive, but in any case does not want to.
replace two variables
char testarray[10]; char size = 0;
and see what happens when you run it ...
And then do the following:
char size = 0; char testarray[10]; char stuff[10];
before you start adding things to testarray, initialize the material, and then after doing your work, print out the stuff [] array. You should see an overflow. In C, the correct rule is to first transfer variables without an array to the assignment list, and the array or arrays last, you have a better chance of debugging.
source share