Primary data type in cpp, C/C++ Programming

What are Primary Data Types?

Integer can be defined according to the size of the data and it can be modified further by using keyword unsigned and signed.  Default declaration is signed; that is a variable can store negative and positive data, to hole only positive data the variable can be changed to unsigned variable which will store only positive data twice its original size.  Therefore the size of the data to be stored in a variable depends on type of declaration.

int x:  The x store from -32768 to 32767 since by default it is a signed integer it can store positive and negative number within that range.

unsigned int x:  The x store from 0 to 65535 since it is declared as signed integer it can store only positive number within that range.

The data type can be declared unsigned for long, char,  small int, and int only.  The double and float can be signed data only.

Void data type is used to declare a generic pointer. 

void *gptr;

 

int *ptr;

gptr = ptr;

char *cptr

cptr = gptr;

Valid only in C

cptr = (char *)gptr;  In C++ type casting operator must be used to change the data type.

Note: In C void pointer can be assigned to non-void pointer without using cast. Where as in C++ cast operator must be used to assign void pointer to non-void pointer. 

Integer data types are of three types; octal, hexadecimal and decimal int x = 123; is decimal data type

int x = 0123; is octal data type int x = 0x12A; is hexadecimal

The primary data type like long, integer

 

Posted Date: 9/20/2012 7:30:31 AM | Location : United States







Related Discussions:- Primary data type in cpp, Assignment Help, Ask Question on Primary data type in cpp, Get Answer, Expert's Help, Primary data type in cpp Discussions

Write discussion on Primary data type in cpp
Your posts are moderated
Related Questions
Write a program to create a binary file and store the following data "hello", 0x0030,'1', 1.234  Using visual studio examine the binary file and note how the day is stored   Answe

Binary logical bit-wise operators  There are three logical bit-wise operators :                   &             and                 |              or

For the circuit shown in Figure, verify (a) the battery voltage V , (b) the total resistance of the circuit, and (c) the values of resistance of resistors R 1 , R 2 and

Multidimensional Arrays - Every dimension is specified in separate brackets e.g. int arr[4][3]; This is a two-dimensional array with 4 as row dimension and 3 as

Need an indicator Project Description: Need an indicator which indicates target and trailing sl after entering trades. Skills required are C Programming, C++ Programming,

Verifone pos offline mod vx670 Project Description: I want a programmer who will build custom application for Offline VX670 to collect and save info+pin 1) Press the am

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can b

Project Description: Need someone to prepare a trading platform and sophisticated trading strategy. Must have knowledge and experience in most of these: QuickFIX, Esper, Quan

how can i make a program with !(not) operator

3 kilograms of peebles are needed for converting an area of 1 square meter.the rate of the peeble is 5 per kilogram