Skip to main content
added 82 characters in body
Source Link
Cybergibbons
  • 5.4k
  • 7
  • 34
  • 51

Your declaration of char buffers is done like so:

char* move1 = "N/A";

This will only allocate 3 characters with an additional one for null termination i.e. not long enough to hold the name.

You need to do:

char buffer[16];

Where the length is long enough to hold your string.

Your declaration of char buffers is done like so:

char* move1 = "N/A";

This will only allocate 3 characters.

You need to do:

char buffer[16];

Where the length is long enough to hold your string.

Your declaration of char buffers is done like so:

char* move1 = "N/A";

This will only allocate 3 characters with an additional one for null termination i.e. not long enough to hold the name.

You need to do:

char buffer[16];

Where the length is long enough to hold your string.

Source Link
Cybergibbons
  • 5.4k
  • 7
  • 34
  • 51

Your declaration of char buffers is done like so:

char* move1 = "N/A";

This will only allocate 3 characters.

You need to do:

char buffer[16];

Where the length is long enough to hold your string.