Presentation is loading. Please wait.

Presentation is loading. Please wait.

Khalid Rasheed Shaikh Computer Programming Theory 1.

Similar presentations


Presentation on theme: "Khalid Rasheed Shaikh Computer Programming Theory 1."— Presentation transcript:

1 Khalid Rasheed Shaikh Computer Programming Theory 1

2 Programming Environment Command Line IDE (Integrated Development System)

3 Library and Run-Time Files library Files Math Library Run-Time Object Files Header Files Programmer Generated Files

4 Writing a program void main(void){ printf("I can speak German"); } Saving Programe Making an.EXE Compiling Linking Executing a Program

5 Errors Syntax Errors Logical Errors

6 Basic Structure of C programs Function Definition Delimiters Statement Terminator Program Style, Round One o void main(void){ printf("Hello");}

7 The printf Function printf("My First C Program");

8 Exploring the printf function Printing Numbers o printf("Number: %d", 2) ; Format Specifiers Printing String o printf("$s is an %s" 2, "int") Printing Characters

9 Variables Constant and Variables o Defining o Declaring o Assigning

10 Variables Type int char float double

11 Input / Output float flt = 2.3; printf("%.1f", flt);

12 The scanf() Function float years, days; printf("Enter age in Years"); scanf("%f",&years); days = years*365; printf("Your age is %.1f", days)

13 The Address Operator (&) scanf("%f",&years); printf("Address = %d, value = %f ", years, &years);

14 Operators Arithmetic Operators Operator Precedence o (B)rackets, (O)rder, (D)ivision, (M)ultiplication, (A)ddition, (S)ubtraction The Reminder Operator o answer = 13 % 5; Expression Vs Variables o days = years * 365 Arithmetic Assignment Operators Increment operators Relational operators


Download ppt "Khalid Rasheed Shaikh Computer Programming Theory 1."

Similar presentations


Ads by Google