HELP

Can any one suggest a way to store the hex decimal number in 0x form in arduino?????

the hex decimal number

What hex decimal number? ALL data is stored in binary. The representation (binary, octal, decimal, hexadecimal, etc.) matters only when you display a value.

unsigned long x = 0xdecea5ed;

(Great topic title, BTW)

unsigned long x=0xdecea613, its fine but when we read in a hexa decimal number through input and have to store it in a array for further transmission how could we achieve this??

Are you trying to read a supplied number in hex, or output one?

For outputting over serial, see https://www.arduino.cc/en/Serial/Print

For outputting over most other protocols, what you’re asking doesn’t make sense, except in the case of generating a string containing numbers represented as hex (for example, because you’re serving it up as a webpage that needs it to be in hex).

sscanf is the obvious solution, but knife-and-forking it takes a lot less code space.

strtoul String*ToUnsignedL*ong

const char source[] = "abcdef!";

void setup() {
  Serial.begin(115200);
  char* behind;

  unsigned long result = strtoul(source, &behind, 16);

  Serial.print(F("result 0x"));
  Serial.print(result, HEX);
  if (behind) {
    Serial.print(F(", text after parsed: '"));
    Serial.print(behind);
    Serial.write('\'');
  }
  Serial.println();
}
void loop() {}
result 0xABCDEF, text after parsed: '!'

See I have to transmit a IR Decoded code to a TV. It reads only the code with 0x form so I inputted the Hexadecimal number and stored it in a array. But now I have to transmit it in 0x form.How can I do the same??

so I inputted the Hexadecimal number and stored it in a array

Where is that code?

But now I have to transmit it in 0x form.

Nonsense. The device receiving the value can no determine if you send a decimal value, a hexadecimal value, a binary value or an octal value. The VALUE is the same, regardless of which base was used to define the value.

ARUN_M: See I have to transmit a IR Decoded code to a TV. It reads only the code with 0x form so I inputted the Hexadecimal number and stored it in a array. But now I have to transmit it in 0x form.How can I do the same??

No, the receiver works in binary. They wrote the codes out for the humans in hex to make them easier to read. But you can only send as binary.

You have to understand the difference between the abstract concept of a number and the written representation of a number.