Hi how to modify character size as 2 bytes in C ? because the size of character in C is 1 byte only
-
2http://stackoverflow.com/questions/12643580/how-do-i-use-3-and-4-byte-unicode-characters-with-standard-c-strings][1] Check This Link – Sathish Feb 25 '14 at 14:32
5 Answers
No it is not possible. You cannot modify the character size to 2 bytes as the size of character is set to 1 byte by default. You cannot modify the data types. You can probably use a array of characters to store more than one character like:
char s[10];
On a side note:-
From here
Size qualifiers alter the size of the basic data types. There are two size qualifiers that can be applied to integer: short and long. The minimum size of short int is 16 bit. The size of int must be greater than or equal to that of a short int. The size of long int must be greater than or equal to a short int. The minimum size of a long int is 32 bits.

- 168,305
- 31
- 280
- 331
You can't change any data type size. You need to change the data type depending on the values you are going to store..
If you need to store more than one character,use the array of character as below..
char a[2];
In above declaration variable 'a' will hold string of two characters..

- 1,999
- 1
- 15
- 21
You can do as following,
typedef unsigned short newChar;
int main()
{
newChar c = 'a';
}

- 320
- 1
- 6
C uses Ascii format of storing characters, so the range of these ASCII characters 0-255. 0-127 are general ascii character set. 127 onwards is extended set. So C supports 1 byte characters only. Whereas Java uses unicodes, which has a larger range, so the storage in Java for characters could be greater than 1 byte.