Skip to content

cs2113f18/template-c-0

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

C Module 0: Introduction

Exercise 0.1

Use the editor below to write your first C program mimicking the one above, but with a more creative message.

// Paste your program here

Exercise 0.2

Type up and compile the above program. What is the compiler error reported?

Exercise 0.3

What is the error produced by compiling this program?

Exercise 0.4

What is the error produced by compiling this program?

Exercise 0.5

What is the error produced by compiling this program?

Exercise 0.6

What is the error produced by compiling this program?

Exercise 0.7

What is the error produced by compiling this program?

Exercise 0.8

What is the error produced by compiling this program?

Exercise 0.9

What is the error produced by compiling this program?

Exercise 0.10

What kind of a compiler error do you get if you try to use a reserved word as an identifier? Use a reserved word to declare an integer identifier.

Exercise 0.11

What happens if you omit the "L" or "LLU" when declaring numStarsInUniverse and largestIntegerInC? What happens if you use %d for the largestIntegerInC print statement?

Exercise 0.12

Adjust the amount of space used in the printf call. What happens if x has more digits than are reserved? What happens if it has fewer digits?

Exercise 0.13

What print command would you use to print PI with a reserved width of 10 characters and only one digit after the decimal place? Does the reserved width include the decimal point and "e+" notation characters?

Exercise 0.14

It's a common error to mistype the format string. What happens when you reverse the %d and %f specifiers in the program above?

Exercise 0.15

What happens if you use double quotes when assigning a char? What happens if you put multiple letters within single quotes?

Exercise 0.16

Use the ASCII table above to assign c1 and c2 to numeric values that represent your initials. Then print them using both the %d and %c format specifiers.

Exercise 0.17

What is the program's output?

Exercise 0.18

Put the following code into the editor below. What does it print out? What is its significance?

Exercise 0.19

What happens when you try to modify one of the const variables? Is this a compile-time or a run-time error?

Exercise 0.20

There is a bug in this code! Why won't it print "i is not 5" like the developer expected? Is this a compile-time or run-time error?

Exercise 0.21

Without running it, what is the error in the code?

Exercise 0.22

Use for-loops to print "hourglasses" of different sizes. Enter your code here:

// Paste your program here

About

C Module 0: Introduction

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published