When you declare a char*, (or any other variable) it contains garbage data. This data doesn't ponit to anything that your program can or should write to.
You use some memory through a pointer, you need to allocate it. Either
1 2 3
char memory[80];
char *s = memory;
//though this makes s a bit redundant.
Or
1 2 3
char *s = newchar[80];
//and then at the end of your function
delete[] s;//for cleanliness
Notice that either way, your code isn't good. After the for loop, s points to '\0' thus printing *s (which, by the way, can only print a single char) or s (which is probably what you wanted) will print nothing.
Now, if you have two pointers point to the same memory (which looks like what shm is meant for), this is not going to happen. triple-reply!It's odd that I haven't seen a quadruple one yet..