Posts

Showing posts from May, 2017

Generation of computers

Computer An automatic electronic machine used for making calculations for controlling operations that are expressible in numerical or logical terms. Ancestor of computer §   Mechanical §   Electromechanical Mechanical computer An example of mechanical computer is PASCALINE. This is also known as arithmetic machine.  It was described in 1624. Charles Babbage discovered two types of mechanical computer. The first one is difference engine and the second one is analytical engine. The first programmer in analytical engine was Lady Ada Lovelace. The first electromechanical computer is the Mark-1. Generation of computer Computers can be classified based on the technology used, switching device used, storage device used, switching time used and software developed etc. This can be considered as generation of computers. First Generation In first generation of computers vacuum tubes are used as active devices. Vacuum tubes generate great heat. So the operat...

Unions in C Language

Image
Unions in C Language Unions are conceptually similar to structures . The syntax of union is also similar to that of structure. The only differences is in terms of storage. In structure each member has its own storage location, whereas all members of union uses a single shared memory location which is equal to the size of its largest data member. This implies that although a union may contain many members of different types, it cannot handle all the members at same time . A union is declared using union keyword. union item {  int m;  float x;  char c; }It1; This declares a variable It1 of type union item . This union contains three members each with a different data type. However only one of them can be used at a time. This is due to the fact that only one location is allocated for a union variable, irrespective of its size. The compiler allocates the storage that is large enough to hold largest variable type in the union . In the union ...

The Preprocessor

The Preprocessor A unique feature of c language is the preprocessor. A program can use the tools provided by preprocessor to make his program easy to read, modify, portable and more efficient. Preprocessor is a program that processes the code before it passes through the compiler. It operates under the control of preprocessor command lines and directives. Preprocessor directives are placed in the source program before the main line before the source code passes through the compiler it is examined by the preprocessor for any preprocessor directives. If there is any appropriate actions are taken then the source program is handed over to the compiler. Preprocessor directives follow the special syntax rules and begin with the symbol # and do not require any semicolon at the end. A set of commonly used preprocessor directives Preprocessor directives: Directive Function # define Defines a macro substitution # undef Undefines a macro ...