Tuesday, 14 May 2013

Some Of The Applications Of C-Language

‘C’ was initially used for system development work, particularly the programs that create the operating system. The main reason for the popularity of ‘C’ is that it produces code that runs nearly as fast as a code written in Assembly language. ‘C’ can be applied in the following areas:

 ............................................................................................................
•  Op­er­at­ing Sys­tems
•  Lan­guage Com­pil­ers
•  As­sem­blers
•  Text Ed­i­tors
•  Print Spool­ers
•  Net­work Drivers
•  Mod­ern Pro­grams
•  Data Bases
•  Lan­guage In­ter­preters
•  Util­i­ties

Monday, 11 March 2013

A Brief History of C and the Standard




  1. A Brief History of C and the Standard



Until the past few years, no absolute standard for the C language existed. The C
Programming Language, by Kernighan and Richie, served as a standard, but most
compiler manufacturers added extensions and did not follow all the specifications
presented by Kernighan and Richie. As C became one of the most popular computer
languages for programming small computers, the need for a true standard became
apparent.


The American National Standards Institute (ANSI) produced standards that help keep each of the compilers working in the same manner. These standards, which are very exacting, spell out exactly what the language should do and what should not
happen. Specified limits and definitions exist also.

C is an interesting language. Because its syntax is simple, it’s not the most powerful language, and it has only a few operations. Most of C’s power comes from these attributes:

• C can address and manipulate memory by direct address. A program can obtain the memory address of any object (both data objects and functions) and manipulate without restriction the contents of the memory specified by the address. This capability is good to have because it allows flexibility. However, you have no protection from the program overwriting critical parts of the
operating system when you are programming a PC using DOS.


• C has a powerful library of functions. This library of functions enables programmers
to perform I/O, work with strings (which are arrays of characters), and
perform many other tasks.



There is a lot of talk (much I consider to be blown out of proportion) about portability. Generally, for each program, you should consider whether it is likely to be needed on a different system, and how much effort must be dedicated to planning the
move to a future system. Some C programming is never portable. Programs written for Microsoft Windows, for example, don’t move well to the Apple Macintosh or IBM’s
OS/2 Presentation Manager (a system much like Windows). The decision to maintain portability is one that you must make—sometimes the effort to maintain portability
far exceeds what is required if later parts of the program must be rewritten.  



Many of these limits are really compiler limits; however, because they affect the language, you sometimes must take them into consideration. These limits are not usually a problem;
in the ten years that I've been writing C programs, I've run into problems with these limits only once or twice.

Friday, 30 November 2012

what is the default type of function in c


The function type is not required by C. If no function
type is declared, the type defaults to
int. However, if no type is provided, the maintainer cannot determine

if you wanted to use the default (int) or if you simply

forgot to declare a type. To avoid this confusion,always declare the function type and do not use the default.



  • How ever this facility was removed in the improved version of c i.e in c99 and later versions and it is no more valid.

Wednesday, 21 November 2012

some areas where unions are used


Unions are used frequently when specialized type conversions are needed because you can refer to the data held in the union in fundamentally different ways. For example, you might use a union to


manipulate the bytes that constitute a double in order to alter its precision or to perform some

unusual type of rounding.

Thursday, 8 November 2012

difference between delarations and definitions

A declaration provides basic attributes of a symbol: its type and its name. 
A definition provides all of the details of that symbol--if it's a function, what it does; if it's a class, what fields and methods it has; if it's a variable, where that variable is stored. 
Often, the compiler only needs to have a declaration for something in order to compile a file into an object file, expecting that the linker can find the definition from another file.
 If no source file ever defines a symbol, but it is declared, you will get errors at link time complaining about undefined symbols.

 

format specifier %n


The %n Specifier:



The %n format specifier is different from the others. Instead of telling printf( ) to display
something, it causes printf( ) to load the integer variable pointed to by its corresponding argument
with a value equal to the number of characters that have been output. In other words, the value that
corresponds to the %n format specifier must be a pointer to a variable. After the call to printf( ) has
returned, this variable will hold the number of characters output, up to the point at which the %n
was encountered. Examine the next program to understand this somewhat unusual format code:





#include <stdio.h>
int main(void)
{
int count;
printf("this%n is a test\n", &count);
printf("%d", count);
return 0;

output:

this is a test
followed by the number 4.

Wednesday, 7 November 2012

format specifier %p


Displaying an Address



If you want to display an address, use
%p. This format specifier causes printf( ) to display a
machine address in a format compatible with the type of addressing used by the computer.