Turbo C is a compiler and development environment for the programming language C. It came out in1987 and merged into Turbo C++ in 1990. Turbo C was popular due to its low price, speed anddocumentation. It became freeware in 2006. Data types identify which kind of information theprogrammer wants to use. Different data types take varying amounts of memory space and thecompiler interprets them in different ways. The fundamental data types of integers, characters, boolean and floating pointnumbers are all available in Turbo C.
1. Characters
Char is the fundamental character type variable. Turbo C stores it in memory using 1 byte of memory with an integer value from 0-255. An unsigned char can store values from -128 to +127. Use arrays of characters to store multiplecharacter data like words or sentences. Some examples:char m;char n = 'z';char o[] = { 'e', 'x', 'a', 'm', 'p', 'l', 'e' };char p[] = "My name ";char q[255];char r[80] = "example";char *s = "hi";unsigned char t;
Char is the fundamental character type variable. Turbo C stores it in memory using 1 byte of memory with an integer value from 0-255. An unsigned char can store values from -128 to +127. Use arrays of characters to store multiplecharacter data like words or sentences. Some examples:char m;char n = 'z';char o[] = { 'e', 'x', 'a', 'm', 'p', 'l', 'e' };char p[] = "My name ";char q[255];char r[80] = "example";char *s = "hi";unsigned char t;
2. Integers
Use the Int data type to store numerical integer values. Integers are the numbers (..., -3, -2, -1, 0, 1, 2,
Use the bool data type to store values of true or false. This uses 1 byte of memory. Some examples:bool b;bool c = true;cool d = false;
Use the Int data type to store numerical integer values. Integers are the numbers (..., -3, -2, -1, 0, 1, 2,
3,). Add the modifiers keywords short and long in front of int to make it store a smaller or larger range of values. How much the value range changes will depend on the specific computer you are using. Add the unsigned keyword in front to make thevariable only store positive values. Signed integers include positive and negative values. Some examples:int a;int b = 5;shortint d;unsigned short int e; int f(6);
3. Boolean
Use the bool data type to store values of true or false. This uses 1 byte of memory. Some examples:bool b;bool c = true;cool d = false;
4. Float
Float is the data type that can store non-integer numerical values like 3.145. Double and long double are increasinglybigger versions of the float data type. Float is 4 bytes, double is 8 bytes, and long double is 8 or 12 bytes. Someexamples:float m;float n = 6.2;double o = 3456780;
Float is the data type that can store non-integer numerical values like 3.145. Double and long double are increasinglybigger versions of the float data type. Float is 4 bytes, double is 8 bytes, and long double is 8 or 12 bytes. Someexamples:float m;float n = 6.2;double o = 3456780;
No comments:
Post a Comment