C1. Introduction to C Language


Course Material
F r o m t h e A u t h o r s D e s k …
Long back I heard of a story from my grand mother which was absolutely a Fiction in the Science of Imagination, The story went like this “That people long back traveled in Space using their own space vehicles and the wars in those days were fought with weapons that can create havoc miles of distance away from their usage. She also used to tell me that the people could communicate with one another with out the help of any medium at any virtual distance they want, I used to hear to these kind of things with great interest as a child. But suddenly one day when I started working with the digital technology and integration with Languages like c and c++ I felt that in those days people were more logical in programming rather than us, it is the vaccum of time generation that could have made the things lost from the history and may be some times we are repeating the history on the other side of the coin. We today really lack the strength what we should have at our academics because of many factors that really bother our education system. We at the age of 20 or sometimes more that that think or take a decision that we want to learn programming, but in many countries the statistics say that by the age of 12 years, teenagers are proving them selves as programmers. It is exaggeration if any body says that he can make programmers in this world, I just believe that we as faculties can act as Mentors and Supporters but not more than that. Through out this course I will make you think “Why we should Program a Computer and How best an Individual can do That?”. I have seen the things happening in the most simplest way in programming to things that can do the same task with much more complication, but afterall why all this difference in Programming Logic arises is the question every gentleman or gentlewoman has to Identify by the time we Finish Our Course. To understand what I mean please type these sample programs into your computer if you are already having the idea of ‘C’ Language else just wait until the things move on to think more better in very few days… The same concept of swapping the values if we plan and analyze can be done in more than four more ways, that is the strength of ‘C’ language as it makes the same problem looks different for different people, but the final solution it gives is different, The lesson what we have to learn from the above construct is that “Innovation Always makes you more Creative and Inventive”. Hope You make a bright career by associating with me…Best of Luck and Let Us Start our Never Ending.  
 Journey of Programming.

void main()
int a = 10, b = 20, c;
printf("\nOriginal Values of a = %d, b = %d", a, b);
c = a;
a = b;
b = c;
printf("\nSwapped Values of a = %d, b = %d", a, b);

void main()
int a = 10, b = 20;
printf("\nOriginal Values of a = %d, b = %d", a, b);
a = a ^ b;
b = a ^ b;
a = a ^ b;
printf("\nSwapped Values of a = %d, b = %d", a, b);

Your Tiny Steps Towards Programming

Why You Should Adopt ‘C’ Language

C is General purpose language.
Structured programming language.
Flexibility towards systems programming.
Flexibility towards application programming.
Availability of large number of operators.
Has small instruction set.
Availability of extensive library functions enhancing basic functionality.
Availability for computers of all types.
Programs highly portable onto multiple platforms.
Program Structure in ‘C’
It is modular programming, called FUNCTIONS.
Out of all FUNCTIONS one should be main().
Components of each function
Function Heading -->Function Name, List of Arguments.
-->List of Argument Declaration.
-->Compound statements.
ARGUMENTS -->They are symbols which represent Information being passed
between the FUNCTION and the other parts of the PROGRAM.

Simple Requirements of ‘C’ Program
Every compound statement should be enclosed in a pair of Braces {}.
Braces can contain one or more ELEMENTARY STATEMENTS and other
Compound statements can be NESTED or INDIVIDUAL.

Programming Languages
Machine Oriented Languages
Problem Oriented Languages
Assembly Language
Machine Language

Each expression statement must end with a SEMICOLON (;).
COMMENTS should be used, and can be used anywhere in the program, with
declaration style as , /*Your Commenting Text Here*/.
Characteristics of a Program
Should posses INTEGRITY.
Should posses’ CLARITY.
Should posses SIMPLICITY.
Should be specific to MODULARITY.
Should posses GENERALITY.
Approaches of Languages
Procedural Language.
Logical Language.
Artificial Intelligent Language.
Object Oriented Language.
It is some structured text which explains the components like…
Sections in ‘C’
1. Documentation Section.
2. Include Section.
3. Define Section.
4. Global Variable Section.
5. Main Section.
6. Variable Declaration Section.
7. Sub-program Section.
Rules to cross check
All KEYWORDS of ‘C’ Language must be declared in LOWERCASE only.
‘C’ is case sensitive Language i.e.; “APPLE” ≠ ‘Apple’( APPLE is Not equal to Apple)
Keywords cannot be used for any other purpose in the program.

No comments: