Character Data- type

So, now we will try to understand, what these all data- types do and how do they declare and work.

Syntax: char  variable_name;

example : char ch;                  <==== This is Declaration.

char ch = ‘a’;          <====This is Initialization.

When we declare character data – type compiler allocates 1byte (=8bits).

So internally, it stores as an ASCII (American Standard Code for Information Interchange) value.

Example: If you initializ character data as ‘A’  it will consider ASCII value as 65.

lly, for ‘a’ ====> 97

and ‘0’ ====> 48     (zero)

C language supports only ASCII code.

Example : ch = ‘a’    <=== 97 in ASCIIUntitled Diagram (5).jpg


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Powered by

Up ↑

%d bloggers like this: