Data types

A variable is defined using one of the following data types.


int

int variables store an integer number ranging from -2,147,483,648 to +2,147,483,647.

int Count;

Count = 7;

float

float variables store a floating point number ranging from 1.175494351 E–38 to 3.402823466 E+38.

float HourlyRate;

HourlyRate = 17.95;

double

double variables store a floating point number ranging from 2.2250738585072014 E–308 to 1.7976931348623158 E+308.

double NumberOfStars;

NumberOfStars = 1.e+21;

char

char variables store a single character. Here's the Wikipedia entry for the ASCII character set.

char OneCharacterOnly;

OneCharacterOnly = 'c';

pointer

pointer variables store a single memory address in conjunction with the type of data found at the memory address. A pointer is indicated by placing an * before the variable name.

int  *pInteger;
char *pCharacter;

array

array variables store a list of one of the above data types. An array is indicated by placing [n] after the variable name, where n is the size of the array.

int  IntegerArray[5];
char CharacterArray[7];

string

C does not have a string data type.


Top