Date : 24/12/2014
Hi friends,
As you all know, Programming is a technical art. To be an efficient developer, you need to write efficient programs. Efficient in the sense of logic, memory and processing. Programming is not related with any language or so. But, still its good to start with C. So lets start with basics of C language.
Sample C Program :-
#include <stdio.h>
void main()
{
printf("\nHello friends!!!Welcome to C Programming");
}
Hi friends,
As you all know, Programming is a technical art. To be an efficient developer, you need to write efficient programs. Efficient in the sense of logic, memory and processing. Programming is not related with any language or so. But, still its good to start with C. So lets start with basics of C language.
Chapter 1
Fundamentals of computers and Introduction to C
Data :- Data are facts &
figures about an entity.
Entity :- Any existing thing
in the world.
The aim of computer is to accept data,
process it and generate information. Just like a manufacturing concern,
which processes raw materials in order
to create finished product. For the data processing different software is
available. Programming Language is such a software, which is useful for data
processing. C is one of the programming
languages.
By using a Programming language user can
specify the procedure for input, process and output in the required format.
This specified procedure is called as a program.
Introduction to C
'C' was written by Dennis Ritchie
at the Bell Laboratories of AT & T Co. in U.S.A. in 1972. 'C' was the result
of a development process which started with an older language BCPL, developed
by Martin Richards. BCPL influenced a language 'B' written by Ken Thompson,
which was the predecessor of 'C'. It provides a variety of data types. 'C' is
not tied to any one operating system or machine. It can be used in any area of
application e.g. Engineering, Science, Education, Business etc.
Features: - 1) 'C' is a
middle level language. It can be used for writing application programs as well
as it can provide the functionalism of low level language
E.g. it allows direct
manipulation of bits, bytes, words, pointers. Thus it combines the elements of
low level and high level languages.
2) 'C' is a structural language -
It sections off the program using braces. It provides modular approach using
user defined functions, labels etc.
3) 'C' is used for designing
Operating System, OS Support Utilities, Compilers, Editors, Word Processors etc.
DOS, UNIX are designed in 'C'.
4) 'C' supports several loop
constructs like FOR, WHILE, DO-WHILE and conditional statements like IF and
SWITCH.
The 'C' program structure:-
Rules –
1)
All keywords should be in lower case.
2)
'C' is case sensitive i.e. ALPHA is
different from alpha.
3)
Keywords can not be used for any other purpose
like for variable names, function names, label names etc.
4)
main() is always the first function
called when any 'C' program execution begins.
5)
Each function or code of block is
separated by delimiters or braces ({,}).
6)
Each statement should be terminated with
a semicolon (;). There may be more than one statement on the same line but each
one of them should be terminated by semicolon.
7)
Comment line should start with /* and
should end with */. If the user forgets to end the comment the whole program
will be treated as a comment.
The 'C' library: - All 'C' compilers
come with a standard 'C' library of functions that perform most commonly needed
tasks. In some implementations the library exists in one large file while in
others it contains in many small files.
If you want to use a particular
function you have to include the library file which provides that function. A
function written by a programmer which is used by many programs can also be
placed in the library file and can be used as and when required.
Steps in compiling and running a
program:-
1)
Editor or word processor - for writing
the source code (program).
2)
The source code is passed through the 'C'
pre processor. The pre processor acts on some special statements called directives
which start with a # sign. The pre processor expands the shorthand of the
directives and produces a code; this is called expanded 'C' source code. It
passes to 'C' compiler.
3)
Compiler converts the expanded source
code into object code (.OBJ file) and provides input to the linker.
5)
Object code along with support routines
is linked together by the linker to an executable code (.EXE file).
6)
The executable code runs using the
system's loader.Sample C Program :-
#include <stdio.h>
void main()
{
printf("\nHello friends!!!Welcome to C Programming");
}
No comments:
Post a Comment