A Quick Introduction to C A Quick Introduction to C Programming..Programming..
MOHIT PATODIYA MOHIT PATODIYA (BCA II(BCA IIndnd Year) Year)
Introduction..Introduction..• C Language was invented by Dennis Ritchi
in 1972.• C Language was invented at Bell Telephone
laboratory.• C is a basic language.• C is a free format language.• C is a middle Level Programming Language.
Standard C..Standard C..
• Standardized in 1989 by ANSI (American National Standards Institute) known as ANSI C
• International standard (ISO) in 1990 which was adopted by ANSI and is known as C89
• As part of the normal evolution process the standard was updated in 1995 (C95) and 1999 (C99)
• C++ extends C to include support for Object Oriented Programming and other features that facilitate large software development projects
• C is not strictly a subset of C++, but it is possible to write “Clean C” that conforms to both the C++ and C standards
Components Components of C..of C..• Keywords
• Identifiers• Data Types• Operators• Variables• Separators
KeyworKeywordsds
Keywords are the words that convey a special meaning to the language compiler.
Keywords in C..
1. auto2. break3. case4. char5. const6. continue7. default8. do9. double10. else11. enum12. extern13. float14. for15. goto16. if
17. Int18. Long19. Register20. Return21. Short22. Signed23. Sizeof24. Static25. Struct26. Switch27. Typedef28. Union29. Unsigned30. Void31. Volatile32. while
IdentifierIdentifier
ss
Name given by a user for a part of program
Data types..Data types..
Data types used in C Programming..Data types used in C Programming..
Data types Term Control String
Memory Allocation
Example
Integer Int %d 2 bytes 0-9Character Char %c 1 bytes A-Z or a-zFloat Float %f 4 bytes After decimal 6
bytesDouble Double %lf 8 bytes After decimal 12
bits
OperatoOperators..rs..
Operator is performed the specific operation on constant values or operand.
Operators in C..
1. Airthmetic Operator.2. Logical Operator.3. Relational Operator.4. Assignment Operator.5. Increment/Decrement
Operator.6. Bitwise Operator.
Logical Operator..Logical Operator..
Relatinal Operator..
ASSIGNMENT OPERATOR..ASSIGNMENT OPERATOR..
Asssignment operator is the operator which is basically used to assign or initilise the values of the variables..
Int a=10;
Increment /Decrement Operator..Increment /Decrement Operator..
Shortening even more some expressions, the increase operator (++) and the decrease operator (--) increase orreduce by one the value stored in a variable. They are equivalent to +=1 and to -=1, respectively. For example :
Example 1, B is increased before its value is copied to A. While in Example 2, the value of B is copied to A and then B is increased.
Bitwise OperatorBitwise Operator
Variable is the named memory location which holds a data value of a particular data type.
Variables..
The declaration of a variable generally takes the following form :-
datatype variable 1,variable 2, … … .,variable n;
for example:int num1,num2;
Declaration of Variable..
Seprators are the symbols use in C programming. Such as :-
{}[]();,.
Separators..
ccc
Getting Started With C…Getting Started With C…#include inserts another file. “.h” files are called “header” files. They contain stuff needed to interface to libraries and code in other “.c” files.
This is a comment. The compiler ignores this.
The main() function is always where your program starts running.
Blocks of code (“lexical scopes”) are marked by { … }
Print out a message. ‘\n’ means “new line”.