Saturday, January 14, 2012

Why the output of following program is segmentation fault?

My guess is, the pointer is hitting the null character at the end of the string, THEN incrementing that character by 1, so the while loop's check for the null character fails and the next pointer access is beyond the end of the string in a section of memory that hasn't been allocated.

0 comments:

Post a Comment