4

I searched a lot about the difference of unichar and char but did't get any clear concept. also tell me difference about char[] and unichar[].

when use char and unichar ??

Bhavin Ramani
  • 3,221
  • 5
  • 30
  • 41
Hitesh Agarwal
  • 1,943
  • 17
  • 21

2 Answers2

6

char is 8 bits and represents either an arbitrary 8-bit number, or a UTF-8 code unit, or a code unit in some other character encoding.

unichar is 16 bits and represents a UTF-16 code unit.

rob mayoff
  • 375,296
  • 67
  • 796
  • 848
6

unichar is twice the size of char.

unichar often used in other language codes:

difference for example:

char a = 'y'; (correct)
char a = '字'; (wrong)

unichar a = '字'; (correct)

char a[2]  : 8bit * 2

unichar a[2] : 16bit *2

hope it helps.

arrfu
  • 182
  • 7