a quick introduction to c programming

22
A Quick Introduction to C A Quick Introduction to C Programming.. Programming.. MOHIT PATODIYA MOHIT PATODIYA (BCA II (BCA II nd nd Year) Year)

Upload: mohit-patodia

Post on 16-Jan-2017

125 views

Category:

Education


0 download

TRANSCRIPT

Page 1: A quick introduction to c programming

A Quick Introduction to C A Quick Introduction to C Programming..Programming..

MOHIT PATODIYA MOHIT PATODIYA (BCA II(BCA IIndnd Year) Year)

Page 2: A quick introduction to c programming

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.

Page 3: A quick introduction to c programming
Page 4: A quick introduction to c programming

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

Page 5: A quick introduction to c programming

Components Components of C..of C..• Keywords

• Identifiers• Data Types• Operators• Variables• Separators

Page 6: A quick introduction to c programming

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

Page 7: A quick introduction to c programming

IdentifierIdentifier

ss

Name given by a user for a part of program

Page 8: A quick introduction to c programming

Data types..Data types..

Page 9: A quick introduction to c programming

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

Page 10: A quick introduction to c programming

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.

Page 11: A quick introduction to c programming
Page 12: A quick introduction to c programming

Logical Operator..Logical Operator..

Page 13: A quick introduction to c programming

Relatinal Operator..

Page 14: A quick introduction to c programming

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;

Page 15: A quick introduction to c programming

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.

Page 16: A quick introduction to c programming

Bitwise OperatorBitwise Operator

Page 17: A quick introduction to c programming

Variable is the named memory location which holds a data value of a particular data type.

Variables..

Page 18: A quick introduction to c programming

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..

Page 19: A quick introduction to c programming

Seprators are the symbols use in C programming. Such as :-

{}[]();,.

Separators..

ccc

Page 20: A quick introduction to c programming

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”.

Page 21: A quick introduction to c programming
Page 22: A quick introduction to c programming