Your SlideShare is downloading. ×
Lecture 3 getting_started_with__c_
Upcoming SlideShare
Loading in...5

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.
Text the download link to your phone
Standard text messaging rates apply

Lecture 3 getting_started_with__c_


Published on

Getting Started with C

Getting Started with C

Published in: Technology
1 Comment
  • Be the first to like this

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide


  • 1.
  • 2. Popularity of ‘C’● Robust● Efficient and fast● Portable● Structured Programming
  • 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 ~ ‘ ! @ # % ^ & * ( ) _ - + =|{}[]:;"<>,.?/
  • 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
  • 5. Constants● A value that does not change during the execution of programming. Constants Primary Secondary Constants Constants
  • 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.
  • 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
  • 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
  • 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”.
  • 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.
  • 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
  • 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 ;