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

Assignment Help:

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

 


Related Discussions:- Primary data type in cpp

Luminous Jewels - The Polishing Game, Byteland county is very famous for lu...

Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Nec

Program that controls the lcd display, Objective:  Construct a C program...

Objective:  Construct a C program that controls the LCD display, and is capable of displaying strings.  Add functions to the C program that allows more control over the display.

Develop a .net wrapper for a c++ dll, Develop a .NET wrapper for a C++ Dll ...

Develop a .NET wrapper for a C++ Dll Project Description: We have a classic VC++ Dll that requires a .NET wrapper built by you. Use latest Visual Studio and .Net framework sh

How many ways are there to initialize an int with a constant, There are two...

There are two ways for initializes in C++ as shown in the example that follows. The first way uses the traditional C notation. The second way uses constructor notation. int foo

Why php is sometimes called as embedded scripting language, Why PHP is some...

Why PHP is sometimes called as embedded scripting language? PHP is a high level language that is used to allow users to write and understand it in human readable form and also

C program to print l diagonal triangle, C program to print L diagonal trian...

C program to print L diagonal triangle: void main() {                 int i=0,j=0;                 int arr[rows][cols];                 for (i=0; i

Define four facilities provided by c language preprocessor, Define Four Fac...

Define Four Facilities Provided by C Language Preprocessor? The C language preprocessor provides four separate facilities that you can use as you see fit:   Inclusion

What is some instance of operator overloading?, A: Here are a few of the ma...

A: Here are a few of the many instance of operator overloading: myString + yourString may concatenate two std::string objects myDate++ may increment a Date object a * b may m

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd