History of C and basics of Programming

Slides:



Advertisements
Similar presentations
Etter/Ingber Engineering Problem Solving with C Fundamental Concepts Chapter 1 Engineering Problem Solving.
Advertisements

CS 1 Introduction CS 1 Part 11. Hardware 1.Central Processing Unit (CPU) 2.Main Memory 3.Secondary Memory / Storage 4.Input Devices 5.Output Devices CS.
Senem Kumova Metin Introduction to Programming CS 115 Introduction to Computing PART I : Computer Basics PART II: Introduction to Computing/Programming.
Overview of Programming and Problem Solving ROBERT REAVES.
Lesson 1 Computers and Computer Systems
COSC 120 Computer Programming
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design First Edition by Tony Gaddis.
1 Engineering Problem Solving With C++ An Object Based Approach Fundamental Concepts Chapter 1 Engineering Problem Solving.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
1 Lecture 1  Getting ready to program  Hardware Model  Software Model  Programming Languages  The C Language  Software Engineering  Programming.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Sixth Edition by Tony Gaddis, Judy Walters,
1 Key Concepts:  Why C?  Life Cycle Of a C program,  What is a computer program?  A program statement?  Basic parts of a C program,  Printf() function?
Starting Out with C++: Early Objects 5/e © 2006 Pearson Education. All Rights Reserved Starting Out with C++: Early Objects 5 th Edition Chapter 1 Introduction.
C programming Language and Data Structure For DIT Students.
CS 0008 Day 2 1. Today Hardware and Software How computers store data How a program works Operators, types, input Print function Running the debugger.
‘C’ LANGUAGE PRESENTATION.  C language was introduced by Dennis Ritchie..  It is a programming language, which can make a interaction between user and.
CHAPTER 1: INTORDUCTION TO C LANGUAGE
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Seventh Edition by Tony Gaddis, Judy.
CS102 Introduction to Computer Programming
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 1 Introduction to Computers and Programming.
Why Program? Computer – programmable machine designed to follow instructions Program – instructions in computer memory to make it do something Programmer.
Chapter Introduction to Computers and Programming 1.
Introduction to Programming Dr Masitah Ghazali Programming Techniques I SCJ1013.
CSC 125 Introduction to C++ Programming Chapter 1 Introduction to Computers and Programming.
Introduction to Programming. Our Book in CS Why Program? Lets watch a video
1 Lecture 2 : Computer System and Programming. Computer? a programmable machine that  Receives input  Stores and manipulates data  Provides output.
Topics Introduction Hardware and Software How Computers Store Data
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming 1.
COP1220/CGS2423 Introduction to C++/ C for Engineers Professor: Dr. Miguel Alonso Jr. Fall 2008.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Chapter 1: Introduction to Computers and Programming.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
CISC105 General Computer Science Class 1 – 6/5/2006.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Seventh Edition by Tony Gaddis, Judy.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 1 Introduction to Computers and Programming.
Programming With C.
Introduction to C++ Programming Language
1 Lecture 2 : Computer System and Programming. Computer? a programmable machine that  Receives input  Stores and manipulates data  Provides output.
Algorithms  Problem: Write pseudocode for a program that keeps asking the user to input integers until the user enters zero, and then determines and outputs.
Programming in C++ Dale/Weems/Headington Chapter 1 Overview of Programming and Problem Solving.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
Computer Programming (1) Code & No.: CS 102 CREDIT HOURS: 5 UNIT Lecture 3.0 hours/week Lab: 2.0 hour/on every week a. This course introduces the students.
Chapter 1 Introduction to Computers, the Internet and the Web.
Brief Version of Starting Out with C++ Chapter 1 Introduction to Computers and Programming.
Chapter 11  Getting ready to program  Hardware Model  Software Model  Programming Languages  Facts about C++  Program Development Process  The Hello-world.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming Dr. Halla Abdel Hameed.
OCR A Level F453: The function and purpose of translators Translators a. describe the need for, and use of, translators to convert source code.
Copyright © 2014, 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Eighth Edition by Tony Gaddis,
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
Copyright © 2015, 2012, 2009 Pearson Education, Inc., Publishing as Addison-Wesley All rights reserved. Chapter 1: Introduction to Computers and Programming.
Chapter 1: Introduction to Computers and Programming
BASIC PROGRAMMING C SCP1103 (02)
Engineering Problem Solving With C An Object Based Approach
CSC201: Computer Programming
Topics Introduction Hardware and Software How Computers Store Data
BASIC PROGRAMMING C SCP1103 (02)
Introduction to C Language
Introduction
Instructor: Chien-Ho Ko
Computer System and Programming
Algorithms Problem: Write pseudocode for a program that keeps asking the user to input integers until the user enters zero, and then determines and outputs.
Introduction to C Topics Compilation Using the gcc Compiler
CHAPTER 1: Introduction to Computers and Programming
Introduction to C Programming Language
Chapter 1: Introduction to Computers and Programming
Topics Introduction Hardware and Software How Computers Store Data
C programming Language
Chapter 1: Introduction to Computers and Programming
Chapter 1: Introduction to Computers and Programming
Presentation transcript:

History of C and basics of Programming

We need a compiler first Please install any C compiler in your machine Suggested: Gnu Compiler Collection (gcc) https://gcc.gnu.org/ Others: https://cygwin.com/ http://www.mingw.org/

Why Program? Computer – programmable machine designed to follow instructions Program – instructions in computer memory to make it do something Programmer – person who writes instructions (programs) to make computer perform a task

Main Hardware Component Categories Central Processing Unit Input Device Output Device Main Memory Secondary Storage Devices

Main Memory Holds both program instructions and data Volatile – erased when program terminates or computer is turned off Also called Random Access Memory (RAM)

Main Memory Organization Bit Smallest piece of memory Stands for binary digit Has values 0 (off) or 1 (on) Byte Is 8 consecutive bits Word Usually 4 consecutive bytes Has an address 8 bits 0 1 1 0 0 1 1 1 1 byte

What is C C is a very powerful complied system programming language Introduced by Dennis Ritchie sometime between 1969 and 1973 at AT&T Bell Labs C is a procedural programming paradigm C allows for recursion and lexical variable scope all while using static typing to help prevent unintentional errors

Example of a C program

What do you need to write and execute a C program Text editor to write your code (source file). Suggested : notepad++ Compiler to convert human-readable source code into machine-readable machine code (executable/.exe file) Inbuilt cmd shell or terminal in your machine to see the output Note: C source file usually end with .c

C applications C is used where speed, space, and portability are important. Most operating systems are written in C. Most other computer languages are also written in C. And most game software is written in C.

Anatomy of a C program C programs normally begin with a comment. The comment starts with /* The comment ends with */ Next comes the include section Finally you will find in a source file are the functions

Comments. Anatomy of a C program The comment starts with /* The comment ends with */ Comment describes the purpose of the code in the file, and might include some license or copyright information. There’s no need to include a comment at the beginning or anywhere else in the file. But it’s good practice and what most C programmers will expect to find.

Include section Anatomy of a C program Almost every C can do nothing without the help of the external libraries. Libraries are nothing but an external code that is written by somebody. You will need to tell the compiler what external code to use by including header files for the relevant libraries. stdio.h is the most popular library, you will see this very often. The stdio library contains code that allows you to read and write data from and to the terminal.

Functions Anatomy of a C program All C code runs inside functions. The most important function you will find in any C program is called the main() function. The main() function is the starting point for all of the code in your program.

What is main() function function body The computer will start running any program from the main() function, the program doesn't start without this function. main() function has a return type of int return values are needed to to decide if the program ran successfully or not. For example, if you tell your main() function to return 0, this means that the program was successful. If any other value is returned, there was a problem in executing your code. The function body must be surrounded by braces.

Homework Install compiler in your machine and run the below code