Hi,
I've been programming for about three weeks now using Xcode. There's been the occasional compilation oddity but for the majority of the time, everything's been working just fine. These past two days I've been tackling pointers, and discovered a persistent problem. Let me explain:
1 2 3 4 5 6
|
char *aString = "Hello";
char *p;
p = aString;
std::cout << *p ;//Should print 'H' on the console.
std::cout << *(p+4); //Should print 'o' on the console.
|
Now let's say that I change *(p+4) to *(p+1). It should instead print 'e' instead, right? But sometimes it doesn't do that, it acts as though I never changed the value inside the parentheses. And once it acts up like this, it can do this even after trying several times, with or without changing anything.
This makes my progress a little harder and more time consuming, and I can't afford this in the future, because I have two weeks to learn about pointers classes, inheritance, exceptions, templates and a bunch of other things.
So, something wrong with my compiler, or is the problem rooted elsewhere?