Successfully reported this slideshow.
DATA TYPES<br />In CC++ , data are mainly divided into three different types. These are:<br />1. Character  type data<br /...
1. Character data type:<br />Characters (letters, digits and punctuation character)<br />Are represented by the “char” dat...
	Character data type:<br />Character data type must be signed and unsigned (either short or long). Both occupying one byte...
Character data type:<br />A signed char is same as an ordinary char and has a range from -128 	to  +127: where as, unsigne...
2. Integer data type:<br />Integer data type (whole numbers) are represented by “int”.<br />Some time, we know in advance ...
3: Float data type:<br />Those number which are in decimal fraction are represented by “float”.<br />We can show float num...
Float data type:<br />We can write a program as:<br />#include<conio.h><br />#include<stdio.h><br />#include<stdlib.h><br ...
Integer data type:<br />We can write a program in CC++ are as shown below.<br />#include<conio.h><br />#include<stdio.h><b...
CONSTANTS:<br />Unlike variable, a constant is a fixed value that does not change during the execution of program. We can ...
NUMERIC CONSTANT:<br />Numbers are referred to as numeric constants. Numeric constants are used for numeric purposes. It c...
In C|C++, numeric constant can be represented in three ways.<br />Integer constant<br />Floating constant<br />Exponential...
OCTAL INTEGER CONSTANT:<br />In C|C++ , any integer constant with a leading 0, is interpreted as Octal constant an octal c...
HEXADECIMAL INTEGER CONSTANT<br />In CC++ any integer constant, which begins with 0x or 0X, is interpreted as hexadecimal ...
FLOATING POINT CONSTANT:<br />The numeric constant, which does not contain a decimal point is known as floating point cons...
NON NUMERIC CONSTANT:<br />Non numeric constant are used for non numeric purposes. Such as to produce output reports, head...
EXPONENTIAL REAL CONSTANT:<br />Floating point constant can also be represented in the E-notation form, and this type of n...
CHARACTER CONSTANT:<br />In CC++, character constant are enclosed within single quotes. It is important to note that the s...
STRING CONSTANT:<br />Any character or sequence of character between double quotes is known as string constant or simply a...
ZAHID HUSSAIN<br />Class no : 	322<br />Subject :	Data types, Constants<br />Shift :	Evening<br />Submitted to UMAR ALI SI...
Upcoming SlideShare
Loading in …5
×

Data types

1,329 views

Published on

p

  • Be the first to comment

  • Be the first to like this

Data types

  1. 1. DATA TYPES<br />In CC++ , data are mainly divided into three different types. These are:<br />1. Character type data<br />2. Integer type data <br />3. Real data type<br />
  2. 2. 1. Character data type:<br />Characters (letters, digits and punctuation character)<br />Are represented by the “char” data type. The “short” data type is the same size as “ char” ,usually one byte.<br />
  3. 3. Character data type:<br />Character data type must be signed and unsigned (either short or long). Both occupying one byte each, but have different ranges. To begin with, it might appear strange as to how a char can have a sign. Consider the statement<br />Char ch=‘A’<br />Char ty=‘B’<br />Char ze=‘D’ etc.<br />
  4. 4. Character data type:<br />A signed char is same as an ordinary char and has a range from -128 to +127: where as, unsigned char has a range from 0 to 255. let us now see a program below<br />#include<conio.h><br />#include<stdio.h><br />#include<stdlib.h><br />Void main()<br />{<br />Char ch=291;<br />Printf(“n%c”,ch);<br />Getch();<br />}<br />
  5. 5. 2. Integer data type:<br />Integer data type (whole numbers) are represented by “int”.<br />Some time, we know in advance that the value stored in a given integer variable will always be positive when it is being used to only count things.<br />We can declared it as below.<br />Int a=20;<br />Int b=40;<br />Int c=30; etc<br />
  6. 6. 3: Float data type:<br />Those number which are in decimal fraction are represented by “float”.<br />We can show float numbers in printf statement of CC++ by “%f”.<br />Float number are declared as<br />Float a=“40.00”<br />Float b=“23.04”<br />Float c=“10.3” etc<br />
  7. 7. Float data type:<br />We can write a program as:<br />#include<conio.h><br />#include<stdio.h><br />#include<stdlib.h><br />Void main()<br />{<br />Float a=29.1;<br />Printf(“n%f”,a);<br />Getch();<br />}<br />
  8. 8. Integer data type:<br />We can write a program in CC++ are as shown below.<br />#include<conio.h><br />#include<stdio.h><br />#include<stdlib.h><br />Void main()<br />{<br />Int a=291;<br />Printf(“n%d”,a);<br />Getch();<br />}<br />We can show the integer data type in C|C++ by “%d” in printf statement.<br />
  9. 9. CONSTANTS:<br />Unlike variable, a constant is a fixed value that does not change during the execution of program. We can say that constant is a values while variable are holders of these values. In C|C++, a constant may be divided into main two types.<br />Numeric constant.<br />Non-numeric constant.<br />
  10. 10. NUMERIC CONSTANT:<br />Numbers are referred to as numeric constants. Numeric constants are used for numeric purposes. It contain:<br />Numeric digits 0 to 9.<br />Plus(+) or minus(-) signs.<br />Decimal points<br />It is important to that note no commas or blanks are allowed in numeric constants.<br />
  11. 11. In C|C++, numeric constant can be represented in three ways.<br />Integer constant<br />Floating constant<br />Exponential real constant<br />
  12. 12.
  13. 13. OCTAL INTEGER CONSTANT:<br />In C|C++ , any integer constant with a leading 0, is interpreted as Octal constant an octal constant is a base 8 numbers system and valid digits in octal system are only 0 through 7. it is important to note that in C|C++ , decimal integer constant cannot start with a leading 0. <br />
  14. 14. HEXADECIMAL INTEGER CONSTANT<br />In CC++ any integer constant, which begins with 0x or 0X, is interpreted as hexadecimal integer constant. An hexadecimal constant is a base -16 number and valid digit in hexadecimal system are 0 through 9,A,B,C,D,E and F.<br />
  15. 15. FLOATING POINT CONSTANT:<br />The numeric constant, which does not contain a decimal point is known as floating point constant. Like integer constant, floating points could either be positive or negative.<br />
  16. 16. NON NUMERIC CONSTANT:<br />Non numeric constant are used for non numeric purposes. Such as to produce output reports, heading or printing messages etc, non numeric constant are divided into two types.<br />Character constant<br />String constant<br />
  17. 17. EXPONENTIAL REAL CONSTANT:<br />Floating point constant can also be represented in the E-notation form, and this type of numeric constant is known as exponential real constant. <br />
  18. 18. CHARACTER CONSTANT:<br />In CC++, character constant are enclosed within single quotes. It is important to note that the single quotes are not part of the character constant, but they serve to delimit it.<br />
  19. 19. STRING CONSTANT:<br />Any character or sequence of character between double quotes is known as string constant or simply a string.<br />
  20. 20. ZAHID HUSSAIN<br />Class no : 322<br />Subject : Data types, Constants<br />Shift : Evening<br />Submitted to UMAR ALI SIR<br />

×