--- Trent Piepho <xyzzy at speakeasy.org> wrote:
> No, you are completely wrong.  It's not null
> terminated.  It will print p_ship
> until it gets to a byte that happens to be zero. It
> has nothing to do with
> compilers.  Try setting the phaser damage to more
> than 255 and see what
> happens when you print it p_mapchars with a %s.

It'd probably be easier to set phaser damage to some
negative number to test. 

> There is no black magic, if you know what you are
> doing.

I guess Hadley didn't know what he was doing when he
wrote in the other 48 instances of printf ("%s \n",
p_mapchars);

> I've fixed more bugs in Hadley's code that you have.

Okay that's nice. As I personally don't program, I'm
not really interested in fixing bugs. I want Hadley's
bots to play better in a pickup style game. 

I tried this:

#include <stdio.h>

main()
{
   char mapchar[2];
   memcpy (mapchar,"ab",2);
   printf ("%s \n",&mapchar);
}

As is turns out, Trent is right, and gcc isn't too
smart. 

But, if you stuck a strncpy instead of memcopy. gcc
will stick a \0 right at the end, even though there's
no way it should have been allowed to do it. 

Anyways, it's not the end of the world. And now we can
fix it everywhere else in the code that it happens. 

In fact, I don't have a c manual anywhere. 

I assume the correct way would be:

printf ("%c%c \n",mapchar[0],mapchar[1]);

Jimmy