I
iC and iC++
This is a continuation of my previous post where I am reviewing/
learning from the book Mastering C Pointers: Tools for programming
power by Robert J. > Traister.. 1990
There is another piece of code in the book that I would like some
clarification in:
#include <stdio.h>
int main (void)
{
char *a;
a = "ANGULAR";
*a = 66;
printf("%s\n", a);
}
Now, this is in a section demonstrating a "poke" operation in C.
He claims that this would return "BANGULAR", replacing the first
character in the string "ANGULAR" with B, as it should.
This compiles, but throws an error during execution. The question is,
where is the error coming from.
learning from the book Mastering C Pointers: Tools for programming
power by Robert J. > Traister.. 1990
There is another piece of code in the book that I would like some
clarification in:
#include <stdio.h>
int main (void)
{
char *a;
a = "ANGULAR";
*a = 66;
printf("%s\n", a);
}
Now, this is in a section demonstrating a "poke" operation in C.
He claims that this would return "BANGULAR", replacing the first
character in the string "ANGULAR" with B, as it should.
This compiles, but throws an error during execution. The question is,
where is the error coming from.