Lecture1 Introduction C Programming
Lecture1 Introduction C Programming
IIT Bombay
Reference: “C How to Program”, Deitel and Deitel, 8th Edition, Chapters 1&2
Computer hardware is the physical machinery of a computer
CPU runs instructions on data (e.g., add two numbers), ~109 instructions per second
Main memory or Random Access Memory (RAM) stores instructions and user data in “volatile”
memory (erased when power is off)
Hard disk stores user files persistently (retained even when power is off)
Input/Output devices: keyboard, mouse, monitor, network card, …
The program picks a number between 1 and 1000, asks user to guess it
User types a number via the keyboard as input to the program
Program checks if number if higher or lower than the number is picked, and
conveys feedback to user
User can guess again based on this feedback, until he gets it right
Editor allows users to write program code or any other text
Compiler translates high level language code to machine format that computer can
understand
Terminal is a place to give instructions to computer to open editor, compile
program, run program
IDE (integrated development environment) allows you to write and run code from
the same interface
Standard output is where users can see output of their program (screen)
Standard input is where users can give inputs to running program (keyboard)
Standard C library provides “functions” (shortcuts) that user can call to read input
or print output to screen
Multiple statements in a program, keywords in dark blue
Comments
What you see on screen when you compile and run the program
The usage of \n causes new line
Can insert multiple new lines in one print statement