C-LANGUAGE NOTES
Some words about Computer Programming languages
Naturally a language is the source of communication between two persons, and also between person to machine like computer. The languages we can use to communicatewith the computer are known as Computer programming languages.Generally there are two major types of languages are available are as follows:1.
Low level languages
2.The set of commands available in low level is complex and not easy tounderstandable. In this category " Assembly " and " machine codes " areavailable. Assembly programs are faster than other high-level language programs.3.High level languages
The set of commands available in high level language is very simple and easy
to understandable.High level languages are further divided into two major categories.
1.Procedure Oriented language
2.In this category we are able to create our project or programs using proceduralapproach means in this type we can able to divide our big project/program intosmall subroutines or procedures. After making procedures we can able to call a‘procedure’ one or more places.The lists of procedural languages are as follows:C languageC++ (Object Oriented)Java (Objected Oriented)Smalltalk (Objected Oriented)Pascal language3.Non-Procedural Languages:
This category also known as ‘Problem Orientedlanguages’. In this type of languages we can able to make program only atspecific range like database. The followings are the examples of Non procedural languages
1.SQL (Structured Query Language)
2.SNOBOL (String processor)
C LanguageHistory
- Developed at Bell Laboratories. first standard version release in 1972.
Developed by Dennis Richee.
Before c a Programming language is very popular in those days the name of thelanguage is B-Language so the developers decided the name of ‘C’ language because C is next to B.
The Integrated Development Environment (IDE):
Turbo c features as integrated Development environment, or IDE,. It is also referred to asthe programmer’s platform.) in IDE you can able to write/save/open your programs or code, compile using short cut keys, and also perform code debugging very easily.
IDE
Common Short cut Keys DescriptionF2 press to Save current work
F3 press to open an existing file
ALT-F3 press to close current
ALT-F9 press to compile only
ALT-F5 press to view the desired output of the program.
CTRL-F9 press to compile+run
ALT-X or ALT-F-X press to exit from TC IDE
C Programs Skeleton (General) <Preprocessor Directives (some time necessary)>
<Macros Definition (optional)>
<function declaration>
< Global Variable (on your demand)>
main () (Necessary)
{ statements }
< function definition>
{ }
- Remember Some common rules for writing C program
Use all commands or statements in lower or small case.
- After completion of a statement excluding main() or loops must insert
(semicolon) as a statement terminator.
Don’t use/declare identifier or variable name same as statement name suppose
int include; this is a wrong statement because include has a special meaning in thelanguage.
Header Files or Preprocessor Directives contains references or links of library functions. That is built-in in the C language.
Suppose if you want to use a function clrscr() ; in the main function so must bedeclared on top # include <conio.h> other wise you could have an prototype error.
Some header files are as followsStdio.h
Conio.h
Dos.h
String.h
Stdlib.h
And many more header files are available in C…
void main(void)
Every C programs consists of one or more functions. No matter how manyfunctions there are in a C program , main is the one to which control is passedfrom the operating system when the program is run ; it is the first function
executed. The word "void" preceding "main" specifies that the function main()will not return a value. The second "void," in parenthesis , specifies that thefunction takes no arguments.