Ikea led table guide

Interesting indeed!!
0x63 is the ASCII code of 'c'.
0x64 is the ASCII code of 'd'.

Why am I missing the ASCII codes for 'a' and 'b'?

Serial.println('abcd', HEX); //shows: 0x6364; why not: 0x61626364
Serial.println('cd', HEX); //shows: 0x6364
Serial.println('ab', HEX); //shows: 0x6162 = ASCII codes of 'a' and 'b'.

Because an int is only 16 bits on an AVR

It's just a collection of characters - it has no intrinsic relation to computer science.

'foobar' is another collection of characters with no particular specific relationship to CS.

I tried the following codes, but failed to bring out 0x61626364:

   unsigned long int x = 'abcd';
  Serial.println(x, DEC);
  Serial.println(x, HEX);   //shows: 0x6364

Because multi-character literals are limited to the size of an int.

Studies on "Multi-character Literal" and "String Literal" are done, and my ignorance, noticed and criticized by @TheMemberFormerlyKnownAsAWOL, on multi-character liteal has been converted into knowledge.

Thank you so much!

By the by: In British English, is it the double quotes or the single quotes that is used to enclose a piece of speech or a title? For example: "Hyde Park" or 'Hyde Park'.

As far as I'm aware, it's not really a matter of grammar, more of typography.

I have got 0x61626364 in DUE in which int is 32-bit.

  unsigned int x = 'abcd';
  Serial.println(x, DEC);    //shows: 1633837924 = 0x61626364
  Serial.println(x, HEX);   //shows: 0x61626364

And the interpretation of the output of the C-codes of my Post-38 is also revealed.

// C program to demonstrate
// Multicharacter literal
#include <stdio.h>
int main()
{
    printf("%d", 'abcd');
    return 0;
}

Output: 1633837924

"Hyde Park" looks preserving more aesthetic value compared to 'Hyde Park'.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.