-->

Learn to code the on-demand coding Languages in an easy way. We help you understand programming concepts and coding Techniques Better.

Wednesday, January 20, 2021

Data Types in C Keywords | Tokens in C

Data Types in C:

                

What is a Data Type?

        The Data Type is the type of data that a variable can store in its Memory. Each Variable in C has an associated data type. Based on the data type, the compiler will Allocates the memory to the variable.

Types Of Data Types :

Basic Data Type

int, char, float, double

Derived Data Type

array, pointer, structure, union

Enumeration Data Type

enum

void Data Type

 void

Data Types And Its Memory Allocation:

Now lets see some memory sizes of Basic Data Types. The memory size of the basic data types may change according to  64-bit operating system. The Memory sizes of other Data Types will be Discussed later.

1 Byte = 8 bits

Range = 2 power (no of bits - 1)

Data Type

Memory Size

Range

char

1 byte

-128  to  127

shot

2 bytes

-32768  to  32767

int

4 bytes

-2147483648 to -2147483647

Long int

8 bytes

  -2^64 to (2^64)-1

float

4 bytes

-32768  to  32767

double

8 bytes

   -2^64 to (2^64)-1

Keywords in C:

    There are 32 keywords in C. A keyword is a reserved word. We cannot use these keywords as the variable name and constant name.

    The keywords are listed below:

auto

break

case

char

const

continue

default

do

double

else

enum

extern

float

for

goto

if

int

long

register

return

short

signed

sizeof

static

struct

switch

typedef

union

unsigned

void

volatile

while

 

 

  

Tokens in C:

    We can define the token as the smallest individual element in C. Tokens are categorized into different parts. Tokens in C is the building block for creating a program in C. 

  • Keywords in C             [listed above]
  • Identifiers in C             [its a variable , will discuss in next topic]
  • Strings in C                  ["hello ", "world"]
  • Operators in C             [+, -, *, /, %, .......etc]
  • Constant in C               [const]
  • Special Characters in C     [@, $, &, .....]

Each and every token will be discussed in later topics.

                                                                                    

prev <---What is C                                                 Next Topic ---> Variables in C        


1 comment:

  1. Thanks for letting me know about data types in C. It's cool and interesting.

    ReplyDelete