Different sizes of same strings - Telnet programming
- by tommyogp
Hi all, I have been trying to create an iphone app sending telnet command. However what puzzling me is that the sizes of certain strings are so much different, particularly when they include \n or \r. I listed out a few examples. Please assist.
const char *a = "play 25\n";
int sizeBitA1 = sizeof(a); // 8 units
int sizeBitA2 = sizeof("play 25\n"); // 9 units
const char *b = "\r\n";
int sizeBitB1 = sizeof(b); // 8 units
int sizeBitB2 = sizeof("\r\n"); // 3 units