Posts

Showing posts with the label Primary data type

Double data type

                                                        Double data type Double is used to define big floating point numbers,it reserves twice the storage for the number .On PCs this likely to be 8 bytes. Initialization:- Syntax:- double<value name>=<value>; Example:- double k=158.368; printf("double:%lf",k); Output: double:158.368 Runtime  initialization of double type variable:- scanf("%lf",&k);

Void Data Type

                                                                                                                          Void Data Type The void type has no values therefore we cannot declare it as variable as we did in case of integer and float. The void data type is usually used with function to specify its type and void has no range.   syntax :- void<function name>(<data type><space><identifier>) void div(int a)

Character Data Type

                                                                        Character Data Type Character type variable can hold a single character and are declared by using the keyword char. As there are singed and unsigned int (either short or long), in the same way there are signed and unsigned chars; both occupy 1 byte each, but having different ranges. Unsigned characters have values between 0 and 255, signed characters have values from –128 to 127. In c# all characters internally represented as integer value of example following are ASCII values of characters. A =65     a =97 B =66     b=98 ...

Float Data Type

                                              Float  Data Type The float data type is used to store fractional numbers (real numbers) with 6 digits of precision. Floating point numbers are denoted by the keyword float. When the accuracy of the floating point number is insufficient, we can use the double to define the number. The double is same as float but with longer precision and takes double space (8 bytes) than float. To extend the precision further we can use long double which occupies 10 bytes of memory space. Syntax:   float <variable name>; float num1; double num2; long double num3; Example: 9.125, 3.1254. Floating Point Data Type Memory Allocation: float double long   double ...

Integer Data Type

                                               Integer Data Types Integers are whole numbers with a range of values, range of values are machine dependent. Generally an integer occupies 2 bytes memory space and its value range limited to -32768 to +32767 (that is, -215 to +215-1). A signed integer use one bit for storing sign and rest 15 bits for number.To control the range of numbers and storage space, C has three classes of integer storage namely short int, int and long int. All three data types have signed and unsigned forms. A short int requires half the amount of storage than normal integer . Unlike signed integer , unsigned integers are always positive and use all the bits for the size of the number. Therefore, the range of an unsigned i...

Primary Data types

                                                     Primary Data types                Data type                     Keyword                Formal Specifier         Size                  Data Range           Character                         char                       ...