How do I write the MAC address ff:ff:ff:ff:ff:ff as a char[] in C?
Do I just do char macaddress[6] = "%0xFF%0xFF%0xFF%0xFF%0xFF%0xFF";
I'm not sure. Thanks!
How do I write the MAC address ff:ff:ff:ff:ff:ff as a char[] in C?
Do I just do char macaddress[6] = "%0xFF%0xFF%0xFF%0xFF%0xFF%0xFF";
I'm not sure. Thanks!
I rather do like this char macaddress[] = "\xff\xff\xff\xff\xff\xff";
There is some coding guide lines for char array initializations, because need to be null-terminated and the size is actually 7.
Do not initialize an array of characters using a string literal with more characters (including the '\0') than the array. Therefore, it is necessary to specify the correct size of a string literal (char s[4] = "abc";).
However, because the result of the expectation always can be obtained even if the size of the string literal is changed, the method of not describing the size (char s[] = "abc";) is recommended.