#include <iostream.h>
#include <string.h>
typedef struct
{
char nadest[6];
char nasource[6];
int type;
char data[160];
int crc;
}frame;
int main()
{
int i;
frame test;
strcpy(test.nadest, "NA0000");
strcpy(test.nasource, "NA0001");
cout << test.nadest << endl;
cout << test.nasource << endl;
return 0;
}
Can someone tell me why when I print the results, it prints NA0000NA0001 for test.nadest, and NA0001 for test.nasource INSTEAD of NA0000 and NA0001 for test.nadest and test.nasource respectively??? For some reason, test.nadest gets the "NA0001" appended to the end of it which is NOT what I want. (I want NA0000 for that only)
Please help me in how to fix this problem. Thanks.