Upcoming SlideShare
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Standard text messaging rates apply

# Lecture 3 getting_started_with__c_

408

Published on

Getting Started with C

Getting Started with C

Published in: Technology
1 Comment
0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to like this

Views
Total Views
408
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
25
1
Likes
0
Embeds 0
No embeds

No notes for slide

### Transcript

• 1. www.eshikshak.co.in
• 2. Popularity of ‘C’● Robust● Efficient and fast● Portable● Structured Programming www.eshikshak.co.in
• 3. Character Set ● A character can a number, alphabet, or any special symbol to represent informationAlphabets A, B, ….., Y, Za, b, ……, y, zDigits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9Special symbols ~ ‘ ! @ # % ^ & * ( ) _ - + =|{}[]:;"<>,.?/ www.eshikshak.co.in
• 4. Constants, Variables andKeywords● A combination of character set’s numbers, alphabets and special symbols forms constants or variable or keywords Alphabets, Numbers and Special Symbols Constants Variables Keywords www.eshikshak.co.in
• 5. Constants● A value that does not change during the execution of programming. Constants Primary Secondary Constants Constants www.eshikshak.co.in
• 6. Variables● Variables in C have the same meaning as variables in algebra. That is, they represent some unknown, or variable, value. x=a+b z + 2 = 3(y - 5)● Remember that variables in algebra are represented by a single alphabetic character. www.eshikshak.co.in
• 7. Keywordsauto double int structbreak else long switchcase enum register typedefchar extern return unionconst float short unsignedcontinue for signed voiddefault goto sizeof volatiledo if static while www.eshikshak.co.in
• 8. Program Structure in C● EACH complete C program is composed of:● Comment statements● Pre-processor directives● Declaration statements● One or more functions● Executable statements www.eshikshak.co.in
• 9. C Syntax and Hello World #include inserts another file. “.h” files are called “header” files. They contain stuff needed to interface to libraries and code in other “.c” files. Can your program have What do the < > more than one .c file? mean? This is a comment. The compiler ignores this.#include <stdio.h> The main() function is always/* The simplest C Program */ where your program startsint main(int argc, char **argv) running.{ Blocks of code (“lexicalprintf(“Hello Worldn”); scopes”) are marked by { … }return 0;} Return ‘0’ from this function Print out a message. ‘n’ means “new line”. www.eshikshak.co.in
• 10. Comment Statements● Formal Comments: /* Comment ….. */● Used for detailed description of functions or operations (for our benefit, not compiler’s).● Can take multiple lines in source file. www.eshikshak.co.in
• 11. Pre-Processor Directives#include -- header files for library functionsExample:#include <stdio.h> Note Space#define -- define constants and macrosExamples:#define e 2.7182818#define pi 3.14159265359 Note Spaces www.eshikshak.co.in
• 12. Declarations● Declarations tell the compiler what variable names will be used and what type of data each can handle (store). ● Example declarations:int a, b, c ;float r, p, q ;double x, y, z ;char m, n ; www.eshikshak.co.in