Web Development for 2012

Alexander Dickson - Web Developer covering PHP, jQuery / Javascript, XHTML, CSS, more

An old classic, implemented to show off my pointers in C

Published on Friday, 10th September 2010.

An old classic I read when I was about 15 was the old HAL => IBM relationship. That is, by adding one to each character in HAL, we can end up with IBM. Funny, eh?

So when reading in K&R about the close relationship between pointers and arrays in C, I decided to crank up this little beauty.

char evil[] = "HAL"; for (char *ptr = evil; *ptr != '\0'; ++ptr) { (*ptr)++; } printf("%s\n", evil); // HAL

Comments

No comments yet.

Leave a Comment

Comment Details

Your email will never be displayed. If you have a gravatar, it will be displayed.

Note: Your comment may require approval before it is posted to the site.

Stack Overflow Profile

view full profile »

About

I'm a web developer from the Sunshine Coast, Australia. more »