Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 1 Introduction to C Programming

Similar presentations


Presentation on theme: "Chapter 1 Introduction to C Programming"— Presentation transcript:

1 Chapter 1 Introduction to C Programming
REV00 REV00 Chapter 1 Introduction to C Programming DDC PENGATURCARAAN I (C)

2 1.1 Introduction We will learn the C programming language
REV00 1.1 Introduction We will learn the C programming language Learn structured programming and proper programming techniques. This course is appropriate for technically oriented people with little or no programming experience. Experienced programmers who want a deep and rigorous treatment of the language DDC PENGATURCARAAN I (C)

3 REV00 1.2 History of C C Evolved by Ritchie from two previous. programming languages, BCPL and B Used to develop UNIX. Now, most operating systems written with C or C++. Hardware independent (portable). By late 1970's C had evolved to "Traditional C“. Standard created in 1989, updated in 1999 DDC PENGATURCARAAN I (C)

4 REV00 1.3 Identifiers In C the names of variables, functions, labels and various others user defined items are called identifiers. The length of these identifiers can vary from one to several character The first character must be a letter or an underscore, and subsequent characters must be either letters, digits, or underscores. Use meaningful identifiers Be consistent DDC PENGATURCARAAN I (C)

5 1.3.1 Correct and Incorrect Identifiers names
REV00 1.3.1 Correct and Incorrect Identifiers names Correct Incorrect count 1count test123 Hi!there High_balance High…balance Total_score Total+score DDC PENGATURCARAAN I (C)

6 REV00 1.4 Basic Data Types Data is information that maybe manipulated by computer A binary digit, or a bit is the smallest item of data Type Size (bytes) char 1 int 2 or 4 float 4 double 8 DDC PENGATURCARAAN I (C)

7 10 a 1.5 Declaring Variables Declaration: REV00 int a = 10; Type Name
Value 10 a Memory location DDC PENGATURCARAAN I (C)

8 REV00 1.6 Constants Constant refer to fixed values that the program may not alter. Constant can be any of the basic data types. Declaration: #define PI 3.142; Keyword Value Name DDC PENGATURCARAAN I (C)

9 1.7 Formatted Input/Output
REV00 1.7 Formatted Input/Output Standard Output with printf( ) Syntax: printf ("Hello World!"); or printf ("Number: %d", a); Hello World! output Number: 10 output DDC PENGATURCARAAN I (C)

10 1.7 Formatted Input/Output
REV00 1.7 Formatted Input/Output Format specifiers: printf ("Number: %d", a); %d is a format specifier that indicates the data should be of type integer. DDC PENGATURCARAAN I (C)

11 1.7 Formatted Input/Output
REV00 1.7 Formatted Input/Output Standard Input with scanf( ) Syntax: scanf ("%d", &a); Input a Memory location DDC PENGATURCARAAN I (C)


Download ppt "Chapter 1 Introduction to C Programming"

Similar presentations


Ads by Google