FUNDAMENTALS OF C
In old days, every language was designed for some specific purpose. As example FORTRAN (Formula Translator) was designed some specific and mathematical application. COBOL (Common Business Oriented Language) is used for business application. So programming language ‘C’ was designed for programming purpose.
C language is one of the most powerful programming language and was developed by Dennis Rithche at AT & T’s Bell laboratories of USA in 1970/1972. It is an improvement over Basic Combridge programming language popularly called B language. It was named C just keeping alphabet order and improvement over B language. It can be used for the write a variety of applications. C language is designed for the operating system Called UNIX and the 90% of the UNIX operating system is written in C. B language is written by Ken Thompson at AT & T’s Bell laboratories. But B language is useful for only some specific problems. This B language is also adapted from a language BPCL (basic combined programming language), which was developed by Martin Richards at combridge university. C has the feature of both BPCL & B. it is excellent, efficient and general purpose language for most of the applications, such as scientific, business and system software application.
Structure of C program
C program is a collection of one or more function. Every function is a collection of statements, performs some specific task. We can define the structure of C program as:
main( ) function
In C language comments is used for documentation purpose. Comments can be taken between /*———-*/. It may be anywhere in the program.
Preprocessor directives are executed before the source code passes through compiler. Mostly used preprocessor directives are #include, #define. #include is used for including header files and other files. #define is used to define the macro name and macro expansion.
3) Global variable:
It may be possible that some variables used in many functions, so it is necessary to declare them globally. So these type of variables are called global variable.
- a) Every C program has one or more functions, if a program has only one function then it must be main( ). Execution of every C program start with main ( ) function. It has two parts, declaration of local variables and statements. The scope of local variable local to that functions only. Statements in the main ( ) function executed one by one.
- b) other functions are the user defined function, which has also local variables and C statements. It is written after the main ( ).
Feature of Programming C
C is quite powerful and commonly used programming language. Its main feature or characteristics are:
- It is quite simple and easy to use programming language.
- It is format free language ie no line number is required. Moreover we can start statement from any column.
- C is case-sensitive language ie it consider same word written in lower and upper alphabet as different way eg: sum, Sum, SUM is taken as different.
- It provides certain commands that allow user to make memory use in bits. It makes C efficient and fast language.
- It is highly portable ie C program written in one computer system can be run successfully on other computer system.
- It has only 32 keywords. So it is quite easy to learn.
- It provides quite large number of data-types which is good feature for a programming language.
- It provides quite large number of built in functions. This feature of C allows us to perform number of tasks without writing own programs.
- It is suitable for graphics programming.
- It supports structure programming, recursion, pointer implementation, and bitwise manipulation.
FUNDAMENTALS OF C
1) State main characteristics of c language.
2.) What do you mean by character set? State four categories of character set in c.
3.) What do you mean by identifier? State various rules for naming an identifier.
4.) What do mean by keyboards? State five keyboards in c
5.) What do you mean by integer constants? State various types of constant in c.
6.) State various rules for naming an integer constant.
7.) State various rules for naming a real constant.
8.) What do mean by a data type? State various data types in c.
9.) What do mean by variables? How are they declared in c?
10.) State basic data type in c.
11.) What is character constant? How it differs from string constant
12.) Which of following are invalid variables and why?
Y2K roll basic pay 2yk roll. No.
Basic pay prices rate@
13.) Which of the following are invalid constant and why?
0.08 0.345 34.982 ABC