

































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Chapter 2 Notes Intro to computing Electrical engineering.
Typology: Lecture notes
1 / 41
This page cannot be seen from the preview
Don't miss anything!


































โ 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.
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
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