Showing posts with label C Programming. Show all posts
Showing posts with label C Programming. Show all posts

Monday, August 12, 2019

Data Types in C Programming Language

In the C programming, data types specify an extensive system used for declaring variables or functions of different types. The C data type of a variables determines how much space it occupies in memory and how the bit pattern stored in memory will be understand by processor.
Various arithmetic datatypes and functional datatypes available in C programming language are enlist below

Data Types in C and Description

datatypes in c language

Basic data types Of C language:

integer type
This type is used to define integer numbers. It is denoted as "int" in the C programs in this c programming tutorial
int number;
number = 5;
Floating-point types.
This type is used to define decimal numbers. It will be denoted as "float" in the c language
float Miles;
Miles = 5.6;
Boolean type
The Boolean type is used to define a variable that consists of only two values true or false
bool b = getc(stdin) == 't' ? true : false;

double - data type
Double in c language is used to define BIG decimal point numbers. The memory reserved for this datatype is twice as compared to int datatype. Likely to be 8 bytes.
double Atoms;
Atoms = 2500000;

char - data type
char data type defines characters in a c program.

char alphabet;
alphabet = 'x';
Enumerated types in C language:
They are also arithmetic types and they are used to define variables that can only be assigned certain discrete integer values throughout the c program.
The type void:
The type specified void returns no value, meaning no value is available. It is used mainly in functions which returning null or no value.

Derived types in C programming:
They include (a) Pointer types, (b) Array types, (c) Structure types, (d) Union types and (e) Function types. Which will be detailed in the next chapters

Characteristics and Features C Programming Language

Features of C programming Language

Features of C Programming Language

1. Modularity.
2. Portability.
3. Extendability.
4. Speed.
5. Flexibility.
6. Compactness.
7. Case Sensitive

Modularity: Ability to breakdown a large module into manageable sub modules called as modularity, that is an important feature of structured programming languages.
1. Projects can be completed in time.
2. Debugging will be easier and faster.

Portability: The ability to port i.e. to install the software in different platform is called portability.
Highest degree of portability:

‘C’ language offers highest degree of portability i.e., percentage of changes to be made to the sources code are at minimum when the software is to be loaded in another platform. Percentage of changes to the source code is minimum. The software that is 100% portable is also called as platform independent software or architecture neutral software. Eg: Java.

Extendability: Ability to extend the existing software by adding new features is called as extendability.

SPEED: ‘C’ is also called as middle level language because programs written in ‘c’ language run at the speeds matching to that of the same programs written in assembly language so ‘c’ language has both the merits of high level and middle level language and because if this feature it is mainly used in developing system software.

Flexibility: Key words or reverse words
ANSIC has 32 reverse words
‘C’ language has right number of reverse words which allows the programmers to have complete control on the language.
‘C’ is also called as programmer’s language since it allows programmers to induce creativeness into the programmers.

ComPactness: C language is Containing only Handful reserve words which help to increase the functionality factor of language depends on the of precise reserve word not on the usage of more reserve words. so compactnes feature refer to the precise use of reserve words in C Language.

Case Sensitive: C / C++ Language is a case ssetive Language. That is can differentiate the charcter is either upper case or lower case. All types of words either reserve words or user defined words are case sensitive.   

History of C Programming Language

The C programming language was devised in the early 1970s by Dennis M. Ritchiean employee from Bell Labs (AT&T).
founder of c programming language- dennis ritchie

In the 1960s Ritchie worked, with several other employees of Bell Labs (AT&T), on a project called Multics. The goal of the project was to develop an operating system for a large computer that could be used by a thousand users. In 1969 AT&T (Bell Labs) withdrew from the project, because the project could not produce an economically useful system. So the employees of Bell Labs (AT&T) had to search for another project to work on (mainly Dennis M. Ritchie and Ken Thompson).
Besides assembler and Fortran, UNIX also had an interpreter for the programming language B. ( The B language is derived directly from Martin Richards BCPL). The language B was developed in 1969-70 by Ken Thompson. In the early days computer code was written in assembly code. To perform a specific task, you had to write many pages of code. A high-level language like B made it possible to write the same task in just a few lines of code. The language B was used for further development of the UNIX system. Because of the high-level of the B language, code could be produced much faster, then in assembly.
History of c programming language

drawback of the B language was that it did not know data-types. (Everything was expressed in machine words). Another functionality that the B language did not provide was the use of “structures”. The lag of these things formed the reason for Dennis M. Ritchie to develop the programming language C. So in 1971-73 Dennis M. Ritchie turned the B language into the C language, keeping most of the language B syntax while adding data-types and many other changes. The C language had a powerful mix of high-level functionality and the detailed features required to program an operating system. Therefore many of the UNIX components were eventually rewritten in C (the Unix kernel itself was rewritten in 1973 on a DEC PDP-11).
For years the book “The C Programming Language, 1st edition” was the standard on the language C. In 1983 a committee was formed by the American National Standards Institute (ANSI)
to develop a modern definition for the programming language C (ANSI X3J11). In 1988 they delivered the final standard definition ANSI C. (The standard was based on the book from K&R 1st ed.).

The standard ANSI C made little changes on the original design of the C language. (They had to make sure that old programs still worked with the new standard). Later on, the ANSI C standard was adopted by the International Standards Organization (ISO). The correct term should there fore be ISO C, but everybody still calls it ANSI C.

Learn Progrmming in C Language

C is a computer programming language. That means that you can use C to create lists of instructions for a computer to follow. C is one of thousands of programming languages currently in use. C has been around for several decades and has won widespread acceptance because it gives programmers maximum control and efficiency. C is an easy language to learn. It is a bit more cryptic in its style than some other languages, but you get beyond that fairly quickly.
c programming language tutorial
C is what is called a compiled language. This means that once you write your C program, you must run it through a C compilerto turn your program into anexecutable that the computer can run (execute). The C program is the human-readable form, while the executable that comes out of the compiler is the machine-readable and executable form. What this means is that to write and run a C program, you must have access to a C compiler. If you are using a UNIX machine (for example, if you are writing CGI scripts in C on your host's UNIX computer, or if you are a student working on a lab's UNIX machine), the C compiler is available for free. 
It is called either "cc" or "gcc" and is available on the command line. If you are a student, then the school will likely provide you with a compiler -- find out what the school is using and learn about it. If you are working at home on a Windows machine, you are going to need to download a free C compiler or purchase a commercial compiler. 
A widely used commercial compiler is Microsoft's Visual C++ environment (it compiles both C and C++ programs). Unfortunately, this program costs several hundred dollars. If you do not have hundreds of dollars to spend on a commercial compiler, then you can use one of the free compilers available on the Web. See as a starting point in your search.
We will start at the beginning with an extremely simple C program and build up from there. I will assume that you are using the UNIX command line and gcc as your environment for these examples; if you are not, all of the code will still work fine -- you will simply need to understand and use whatever compiler you have available.