• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Lecture 3 getting_started_with__c_
 

Lecture 3 getting_started_with__c_

on

  • 452 views

Getting Started with C

Getting Started with C

Statistics

Views

Total Views
452
Views on SlideShare
452
Embed Views
0

Actions

Likes
0
Downloads
23
Comments
1

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel

11 of 1 previous next

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
  • Nice
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Lecture 3 getting_started_with__c_ Lecture 3 getting_started_with__c_ Presentation Transcript

    • www.eshikshak.co.in
    • Popularity of ‘C’● Robust● Efficient and fast● Portable● Structured Programming www.eshikshak.co.in
    • 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
    • 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
    • Constants● A value that does not change during the execution of programming. Constants Primary Secondary Constants Constants www.eshikshak.co.in
    • 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
    • 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
    • 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
    • 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
    • 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
    • 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
    • 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