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

What is abstraction in c++, Abstraction is of the process of hiding unwante...

Abstraction is of the process of hiding unwanted details from the user

Explain the continue statement, The continue statement The continue sta...

The continue statement The continue statement causes the next iteration of the enclosing loop to start. When this is encountered in the loop , the rest of the statements in the

Programming assignment, Introduction. In this assignment you are required t...

Introduction. In this assignment you are required to simulate a maze traversal using so called recursive backtracking (the algorithm is given below). The grid of #s and 0s in the f

Compiler design, Compiler Design - Limit In The Method Instructions

Compiler Design - Limit In The Method Instructions

Required, requiredrequiredrequiredrequiredrequiredrequiredrequiredrequired

requiredrequiredrequiredrequiredrequiredrequiredrequiredrequired

Program for number game, - Create a program that uses at least two function...

- Create a program that uses at least two functions that will be called from your main. This program is a number game program that asks for parts of your phone and after manipulati

Program is to find the area of room, Program is to find the area of room: ...

Program is to find the area of room: Program is to find the area of room with default values using classes & object class room   {   private:     int len;     i

Diploma in IT, Function fact explain how the process of recursion works in ...

Function fact explain how the process of recursion works in C++.In your answer assume that the function is called to calculate the factorial of 6?

Example of function - c program, Here is a short program. It prints out the...

Here is a short program. It prints out the value of a variable "x". Ernie and Bert disagree about what will be printed: Ernie says, the value gets changed in "changeX" so it will p

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