Intro to computing pdf, Lecture notes of Computer Networks

Chapter 2 Notes Intro to computing Electrical engineering.

Typology: Lecture notes

2019/2020

Uploaded on 02/15/2020

Faisalmunir
Faisalmunir ๐Ÿ‡ต๐Ÿ‡ฐ

1 document

1 / 41

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Computer Science: A Structured Programming Approach Using C 1
Objectives
โ To understand the structure of a C-language program.
โ To write your first C program.
โ To introduce the include preprocessor command.
โ To be able to create good identifiers for objects in a program.
โ To be able to list, describe, and use the C basic data types.
โ To be able to create and use variables and constants.
โ To understand input and output concepts.
โ To be able to use simple input and output statements.
Chapter 2
Chapter 2
Introduction to the C Language
Introduction to the C Language
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29

Partial preview of the text

Download Intro to computing pdf and more Lecture notes Computer Networks in PDF only on Docsity!

Objectives

โ To understand the structure of a C-language program. โ To write your first C program. โ To introduce the include preprocessor command. โ To be able to create good identifiers for objects in a program. โ To be able to list, describe, and use the C basic data types. โ To be able to create and use variables and constants. โ To understand input and output concepts. โ To be able to use simple input and output statements.

Chapter 2 Chapter 2

Introduction to the C Language Introduction to the C Language

2-1 Background

C C isis aa structuredstructured programmingprogramming language.language. ItIt isis considered a high-level language because it allows the considered a high-level language because it allows the programmer to concentrate on the problem at hand programmer to concentrate on the problem at hand and not worry about the machine that the program and not worry about the machine that the program will be using. That is another reason why it is used by will be using. That is another reason why it is used by software developers whose applications have to run on software developers whose applications have to run on many different hardware platforms. many different hardware platforms.

FIGURE 2-2 Structure of a C Program

FIGURE 2-3 The Greeting Program

FIGURE 2-4 Examples of Block Comments

FIGURE 2-5 Examples of Line Comments

2-3 Identifiers

One feature present in all computer languages is the One feature present in all computer languages is the identifier. Identifiers allow us to name data and other identifier. Identifiers allow us to name data and other objects in the program. Each identified object in the objects in the program. Each identified object in the computer is stored at a unique address. computer is stored at a unique address.

Table 2-1 Rules for Identifiers

C is a case-sensitive language. Note Note

Table 2-2 Examples of Valid and Invalid Names

FIGURE 2-7 Data Types

FIGURE 2-8 Character Types

sizeof (short) โ‰ค sizeof (int) โ‰ค sizeof (long) โ‰ค sizeof (long long) Note Note

Table 2-3 Typical Integer Sizes and Values for Signed Integers