Introduction to Programming using C (IT1001) Instructor Dr. Vinod Kumar Jain 1 Me: Dr. Vinod Kumar Jain XP • Assistant Professor and Head of CSE Discipline at IIITDM Jabalpur • Education – PhD (IIITM, Gwalior), M Tech (NIT Raipur) • Research Interests: Wireless Networks, WSN, Location Estimation, Machine Learning, • Publications – More than 30 in Reputed Journals and Conferences • Guided 5 PhDs and 12 M tech Students • PI and Co-PI of many Sponsored Research and Consultancy Projects 2 IT1001-Introduction to Programming using C (Dr. V. K. Jain) 1 Course Info. XP Dr Salman Ali AlQahtani 4 Course: “Introduction to Programming using C” Course Code: IT1001 Tentative Time-Table: Batch Lecture-1 Lecture-2 Lab A Wednesday (11:00 AM to 12:00 PM)L206 Thursday (12:00 PM Tuesday (02:00 PMto 01:00 PM)-L206 05:00 PM)-CC FF Lab B Monday (11:00 AM to 12:00 PM)-L106 Tuesday (10:00 AM to 11:00 AM)-L106 Monday (02:00 PM05:00 PM) -CC FF Lab Instructor: Dr. Vinod Kumar Jain Email: vkjain@iiitdmj.ac.in Course Page: https://sites.google.com/view/dr-vinod-kumar-jain/home 4 Objectives ❑ ❑ ❑ XP To provide a conceptual understanding of computers and their working. To provide basic programming skills. At the end of the course, the student is supposed to write a moderately complex C program. 5 IT1001-Introduction to Programming using C (Dr. V. K. Jain) 2 References/Books XP Dr Salman Ali AlQahtani Text Book: 1.Programming in ANSI C – E Balagurusamy, 8th edition, McGraw Hill. 2.“The C - Programming Language” -- Kernighan and Ritchie Reference Book: 1. “Let Us C” --- Yashwanth Kanitkar. 2. “Mastering C” -- Venugopal and Prasad 3. “Exploring C” --- Yashwanth Kanitkar. 4. You may follow any other standard ANSI C book. 6 Assesments XP Dr Salman Ali AlQahtani 8 Assesment Weightage Description Quizzes 20% Two Quizzes (Schedule will be announced in classes ) Midterm Exam 20% Dates as per Academic Calendar Major Exam 30% Dates as per Academic Calendar Lab 25% There will be two exams (Midsem and Endsem) and regular evaluations in each lab Class Participation 05% Based on attendance and performance in the class interactions 7 IT1001-Introduction to Programming using C (Dr. V. K. Jain) 3 How the courses are run? ❑ ❑ ❑ XP There are nearly 10 Teaching Assistants(TAs), who are M.Tech and PhD students. TAs will primarily help you in the Lab. Part. Students for IT1001 is divided into 02 batches for theory and 02 batches for lab. 8 Lab. Part ❑ ❑ ❑ ❑ ❑ XP Use preferably Linux Operating System. ❑ [ Avoid Microsoft windows ! ] Use ANSI C (Standard C). Use “vi” or “vim” editor for creating your files. Lab experiments starts from 21 August 2023. A brief about the 1st exercise will be given towards the end of this class. 11 IT1001-Introduction to Programming using C (Dr. V. K. Jain) 4 Policies, Guidelines,… ❑ ❑ ❑ ❑ XP Questions in the examinations will be from what I teach in the class. Ask your doubts and questions to me. Do not discuss in the class with your friends. Attendance for Lab part is also important and will be counted. Grading will be strictly according to your performance, attendance etc. 12 What is a Computer? XP • The word computer comes from the word “compute”, which means, “to calculate” • Thereby, is an electronic device that What aiscomputer a can perform arithmetic operations at high speed Computer? • A computer is also called a data processor because it can store, process, and retrieve data whenever desired. 13 IT1001-Introduction to Programming using C (Dr. V. K. Jain) 5 What is a Computer? XP Almost all electronic gadgets today are Computers. They are everywhere! 14 Data Processing XP • The activity of processing data using a computer is called data processing Data Capture Data Manipulate Data Output Results Information • Data is the raw material used as input, and information is processed data obtained as the output of data processing 15 IT1001-Introduction to Programming using C (Dr. V. K. Jain) 6 Characteristics of Computers XP 1)Automatic: Given a job, computer can work on it automatically without human interventions 2)Speed: Computer can perform data processing jobs very fast, usually measured in microseconds (10-6), nanoseconds (10-9), and picoseconds (10-12). 3)Accuracy: Accuracy of a computer is consistently high and the degree of its accuracy depends upon its design. Computer errors caused due to incorrect input data or unreliable programs are often referred to as Garbage-In-Garbage-Out (GIGO) 16 Characteristics of Computers XP 4)Diligence: Computer is free from monotony, tiredness, and lack of concentration. It can continuously work for hours without creating any error and without grumbling 5)Versatility: Computer is capable of performing almost any task, if the task can be reduced to a finite series of logical steps 6)Power of Remembering: Computer can store and recall any amount of information because of its secondary storage capability. It forgets or looses certain information only when it is asked to do so. 17 IT1001-Introduction to Programming using C (Dr. V. K. Jain) 7 Characteristics of Computers XP 7)No I.Q.: A computer does only what it is programmed to do. It cannot take its own decision in this regard 8)No Feelings: Computers are devoid of emotions. Their judgement is based on the instructions given to them in the form of programs that are written by us (human beings) 18 Introduction: Computer ❑ ❑ XP A computer is an electronic device, operating under the control of instructions (software) stored in its own memory unit, that can accept data (input), manipulate data (process), and produce information (output) from the processing. Generally, the term is used to describe a collection of devices that function together as a system. 19 IT1001-Introduction to Programming using C (Dr. V. K. Jain) 8 Devices that comprise a computer system Monitor (output) Speaker (output) XP System unit (processor, memory…) Printer (output) Storage devices (CD-RW, Floppy, Hard disk, zip,…) Mouse (input) Scanner (input) Keyboard (input) 20 Why Is A Computer So Powerful? ❑ ❑ ❑ ❑ ❑ XP The ability to perform the information processing cycle with amazing speed. Reliability (low failure rate). Accuracy. Ability to store huge amounts of data and information. Ability to communicate with other computers. 21 IT1001-Introduction to Programming using C (Dr. V. K. Jain) 9 The Primary Components Of A Computer ❑ ❑ ❑ ❑ ❑ XP Input devices. Central Processing Unit (containing the control unit and the arithmetic/logic unit). Memory. Output devices. Storage devices. 22 Input Devices ❑ Primary input devices ❑ Keyboard. ❑ Mouse ❑ Other input devices ❑ digital camera ❑ scanner ❑ microphone XP 23 IT1001-Introduction to Programming using C (Dr. V. K. Jain) 10 The Central processing Unit ❑ ❑ ❑ XP The central processing unit (CPU) contains electronic circuits that cause processing to occur. The CPU interprets instructions to the computer, performs the logical and arithmetic processing operations, and causes the input and output operations to occur. It is considered the “brain” of the computer. 24 Memory XP ❑ Primary Storage Devices ❑ RAM (temporary memory) is the main memory of the computer. ❑ Any information stored in RAM is lost when the computer is turned off. ❑ Read Only Memory or ROM is permanent memory. ❑ Secondary Storage Devices ❑ ❑ ❑ Floppy Disks Hard Disks Compact Discs 25 IT1001-Introduction to Programming using C (Dr. V. K. Jain) 11 How Does a Computer Know what to do? ❑ ❑ ❑ XP It must be given a detailed list of instructions, called a computer program or software, that tells it exactly what to do. Before processing a specific job, the computer program corresponding to that job must be stored in memory. Once the program is stored in memory, the computer can start the operation by executing the program instructions one after the other. 26 An Example XP Work to be done: Buy 1 kg Potato. A sequence of Steps: 1. 2. 3. 4. 5. 6. Take Bag, Money. Go to the Market. Search for good Potato. Buy 1kg Potato. Go home. Stop. 27 IT1001-Introduction to Programming using C (Dr. V. K. Jain) 12 Hardware and Software XP ❑ Hardware: Keyboard, Mouse, Monitor, Printer, CPU, Memory, etc. (Which can be sensed physically) ❑ Software: Set of programs, like – OS: Interface between hardware & user. Compiler: Translates from high level language to machine Language. Other Tools: Internet access, Voice, Video, Games, etc. 28 Computer (Conceptually) XP 29 IT1001-Introduction to Programming using C (Dr. V. K. Jain) 13 A Model ( Human) ❑ Body XP Hardware ❑ Thinking Process (Mind) Software 30 Early Computers XP ❑ Fixed-program computer: Can do specific task(s) which is wired (fixed) into the hardware. E.g.: A Calculator. Drawbacks: No flexibility, cannot be used as a word processor or a gaming console. ❑ Stored-program computer: uses a central processing unit (CPU) and a single separate storage structure ("memory") to hold both instructions and data. 31 IT1001-Introduction to Programming using C (Dr. V. K. Jain) 14 Stored-Program Computers ❑ ❑ XP Program is also seen as data. Program is also stored in memory as data. 32 Von Neumann Architecture XP 33 IT1001-Introduction to Programming using C (Dr. V. K. Jain) 15 Are there other architectures? ❑ ❑ XP Harvard architecture Stores program in a separate memory and data in a separate memory. But, these are rarely used in general purpose computers. 34 What you have to do? ❑ ❑ XP Learn basic commands to work with the linux operating system. Learn vi editor. (This is a software tool which is used to create files). 35 IT1001-Introduction to Programming using C (Dr. V. K. Jain) 16 Your first lab exercise ❑ XP Create a file named first.c whose contents should be: /* This program prints Hello World */ #include<stdio.h> int main( ) { printf(“Hello World”); return 0; } ❑ This will print Hello World 36 Linux commands ❑ ❑ ❑ ❑ ❑ XP Create the file: $ vi first.c Save the file: :wq To compile this file to get executable file ❑ $ gcc first.c If the compilation is successful this generates a file called a.out To executes it: $ ./a.out 37 IT1001-Introduction to Programming using C (Dr. V. K. Jain) 17 Homework XP Learn basic Linux commands and vi editor ❑ Read some book on C language and understand first.c ❑ In the lab the TAs will verify your programs, and they will ask you some questions related to your programs. You will be awarded some marks for each of the lab exercises. ❑ The lecture slides and useful study materials will be kept on my web page: URL:https://sites.google.com/view/dr-vinod❑ kumar-jain/home 38 Next Class … ❑ XP Introduction to languages, Number System, Coding Schemes etc. 39 IT1001-Introduction to Programming using C (Dr. V. K. Jain) 18