C Language: Introduction

Slides:



Advertisements
Similar presentations
An Introduction to Programming By :- Vishal Hirani B.Tech II year (CSE)
Advertisements

Agenda Definitions Evolution of Programming Languages and Personal Computers The C Language.
EC-111 Algorithms & Computing Lecture #1 Instructor: Jahan Zeb Department of Computer Engineering (DCE) College of E&ME NUST.
C Programming for engineers Teaching assistant: Ben Sandbank Home page:
Introduction to C Programming CE Lecture 1 Introduction to C.
CSE1301 Computer Programming Lecture 4: C Primitives I.
Three types of computer languages
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?
Introduction to C Programming Overview of C Hello World program Unix environment C programming basics.
Guide To UNIX Using Linux Third Edition
Guide To UNIX Using Linux Third Edition
Introduction to Unix (CA263) Introduction to Shell Script Programming By Tariq Ibn Aziz.
CMSC 104, Version 9/011 Introduction to C Topics Compilation Using the gcc Compiler The Anatomy of a C Program 104 C Programming Standards and Indentation.
Introduction to C. A Brief History Created by Dennis Ritchie at AT&T Labs in 1972 Originally created to design and support the Unix operating system.
CHAPTER 1: INTORDUCTION TO C LANGUAGE
Prof. R. Willingale Department of Physics and Astronomy 2nd Year C+R 2 nd Year C and R Workshop Part of module PA2930 – 2.5 credits Venue: Computer terminal.
Copyright 2003 Scott/Jones Publishing Brief Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
Computer Science 210 Computer Organization Introduction to C.
CCSA 221 Programming in C CHAPTER 2 SOME FUNDAMENTALS 1 ALHANOUF ALAMR.
Introduction to C++ - How C++ Evolved Most popular languages currently: COBOL, Fortran, C, C++, Java (script) C was developed in 1970s at AT&T (Richie)
Welcome In The World Of ‘C’.  TEXT BOOK: Programming in ANCI ‘C By: E Balagurusamy. TMH  Reference Books: 1) The ‘C Programming Language By: Kernighan.
“C” Programming Language What is language ? Language is medium of communication. If two persons want to communicate with each other, they have to use.
Introduction to C Programming. A Brief History u Created by Dennis Ritchie at AT&T Labs in 1972 u Originally created to design and support the Unix operating.
Programming Design Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh University.
Introduction to Shell Script Programming
Evolution of Programming Languages Generations of PLs.
©Xiaoying Gao, Peter Andreae First Java Program COMP 102 #2 2014T2 Xiaoying Sharon Gao Computer Science Victoria University of Wellington.
Goals of Course Introduction to the programming language C Learn how to program Learn ‘good’ programming practices.
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
History of C and C++ C++ evolved from C ANSI C C++ “spruces up” C
CSE 2541 – Advanced C Programming Instructor: Yang Zhang
1 Agenda Administration Background Our first C program Working environment Exercise Memory and Variables.
First Java Program COMP 102 #2 2015T2 Xiaoying Sharon Gao Computer Science Victoria University of Wellington.
Creating your first C++ program
Programming With C.
History of C 1950 – FORTRAN (Formula Translator) 1959 – COBOL (Common Business Oriented Language) 1971 – Pascal Between Ada.
CSE 2541 – Advanced C Programming. Course info Prereq – CSE 2221 or CSE 222 Co-req – CSE 2231 Website
Programming Fundamentals. Today’s Lecture Why do we need Object Oriented Language C++ and C Basics of a typical C++ Environment Basic Program Construction.
1 Programming in C Hello World! Soon I will control the world! Soon I will control the world!
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.
CMSC 104, Lecture 111 Introduction to C Topics l Compilation l Using the gcc Compiler l The Anatomy of a C Program l 104 C Programming Standards and Indentation.
Agenda Computer Languages How to Write a Simple C Program
CPS120: Introduction to Computer Science Compiling a C++ Program From The Command Line.
Course Instructor: Hira Farman Course : BY:HIRA FARMAN.
 2007 Pearson Education, Inc. All rights reserved. A Simple C Program 1 /* ************************************************* *** Program: hello_world.
Introduction to C Programming Language. History of C  C was evolved by Dennis Ritchie at AT&T Bell Laboratories in early of 1970s  Successor of: ALGOL.
An overview of C Language. Overview of C C language is a general purpose and structured programming language developed by 'Dennis Ritchie' at AT &T's.
1 Types of Programming Language (1) Three types of programming languages 1.Machine languages Strings of numbers giving machine specific instructions Example:
L071 Introduction to C Topics Compilation Using the gcc Compiler The Anatomy of a C Program Reading Sections
小型系統 心情 vs. 古典樂 心情 vs. 古典樂 浪漫求籤系統 美食導航系統 季潔亭雅鈺熒岱芸 美食導航系統 楊氏音樂模擬大會考人瑋 若維 芷萱 伽倩 楊氏音樂模擬大會考 麥當勞熱量計算系統 火星文困擾你嗎 ? 火星文困擾你嗎 ? 歌詞知多少 - 挑戰你的腦容量英琪 日馨 青雪 鈺娟.
C++ Programming Chapter 1 Programming & Programs.
Introduction to C Topics Compilation Using the gcc Compiler
UMBC CMSC 104 – Section 01, Fall 2016
Computer Science 210 Computer Organization
Introduction to C Language
Programming Fundamental
Instructor: Chien-Ho Ko
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
Introduction to C Topics Compilation Using the gcc Compiler
Introduction to C Programming Language
Welcome In The World Of ‘C’.  TEXT BOOK: Programming in ANSI ‘C By: E Balagurusamy. TMH  Reference Books: 1) The ‘C Programming Language By: Kernighan.
Computer Science 210 Computer Organization
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
Govt. Polytechnic,Dhangar
Introduction to C Topics Compilation Using the gcc Compiler
Creating your first C program
2008/09/29: Lecture 7 CMSC 104, Section 0101 John Y. Park
Introduction to C Topics Compilation Using the gcc Compiler
Introduction to C Topics Compilation Using the gcc Compiler
Presentation transcript:

C Language: Introduction C Programming CISY 238 Bill Klinger C Language: Introduction

C Language: Introduction RVCC Tutoring Center Room S-020-C C Language: Introduction

C Language: Introduction Outline Computer languages C Background Programming UNIX environment Editor C fundamentals Getting started C Language: Introduction

C Language: Introduction Computer Languages Computers powerful complex use simple instructions Language development machine language assembler high level languages 4GLs C Language: Introduction

Evolution of Computer Complexity C Language: Introduction

C Language: Introduction Early Languages Fortran Formula translation Scientific applications COBOL Common Business Oriented Language Business / data applications C Language: Introduction

C Language: Introduction Language Explosion Algol Designed with programming concepts in mind Basic The first interactive language Simula Extended Algol to facilitate simulations, first O-O language Snobol Specially designed to handle string manipulation LISP Used in artificial intelligence applications PL/1 Language for everyone (therefore no one) C Language: Introduction

C Language: Introduction Created by Dennis Ritchie early 1970’s Bell Labs C comes after B C++ comes after C Design principles high level language allow for detailed control of the system C Language: Introduction

C Language: Introduction UNIX implemented in C Distributed to universities Becomes commercial success widely available efficient C/C++ still the language of choice for ‘serious’ applications C Language: Introduction

C Language: Introduction C Language Usage systems programmers (drivers) operating systems (Linux, UNIX, Windows, et.al.) embedded systems real-time systems games applications education C Language: Introduction

C Language: Introduction ANSI C Standard established to ensure common language set by vendors allows programs to ‘port’ to different computers ANSI American National Standards Institute has established standards for many languages C Language: Introduction

C Language: Introduction A Word About C++ Extends C all of C in C++ C++ adds object oriented programming incorporates classes from Simula does some ‘clean up’ C Language: Introduction

C Language: Introduction Programming The process of translating needs (requirements) into directions a computer can execute. C Language: Introduction

C Language: Introduction Programming An art there is a beauty in good programs it is a creative process A science there is certainty in programs programming requires precision computer will do what it is instructed to lather – rinse – repeat C Language: Introduction

C Language: Introduction The Process Write the code called ‘source code’ written using an editor Compile the code using a compiler creates object modules Link the objects put together the pieces creates the executable Test / debug C Language: Introduction

C Language: Introduction The Process Write the code use vi, pico, notepad, TextPad, or some editor Compile use cc on UNIX Link cc will also link Test / debug C Language: Introduction

C Language: Introduction UNIX Editors vi available on all UNIX / Linux systems primitive but powerful pico simpler than vi less powerful C Language: Introduction

C Language: Introduction The C Language small, efficient and powerful easy to learn (sort of) precise computer control no hidden mechanisms or magic C Standard Library C Language: Introduction

C Language: Introduction C Source File Creation Use text editor (vi, emacs, pico, TextPad, NotePad, etc.) to create a file for C language, the file must have a .c suffix C Language: Introduction

C Executable Program Creation C is a compiled rather than an interpreted language, the .c source file can not be directly executed like a shell script compile using the C compiler cc: $ cc program.c ---> a.out (where a.out is the default executable file name) run program by entering its name: $ a.out can choose a different name for the executable: $ cc -o myprogram program.c ---> myprogram - or: $ mv a.out myprogram C Language: Introduction

C Language: Introduction C Source File // a basic program #include <stdio.h> main() { printf(“Hello World”); } hello.c C Language: Introduction

C Language: Introduction C Source File Contents main function; main tells where the program starts, one and only one main a left brace { is the beginning and a right brace } is the end of a function or code block parentheses ( ) indicate a function definition C Language: Introduction

C Language: Introduction Printing Use the ‘printf’ statement Form printf(“<string>”); Note: string is enclosed in quotes C statement ends in semicolon C Language: Introduction

C Language: Introduction Printing printf ‘prints’ a stream of characters whatever is in <string> is output no automatic “new lines” Use \n to print a new line character printf does not actually print to a printer goes to UNIX standard output default is to terminal C Language: Introduction

C Language: Introduction Variable Basics Must declare variables before using them e.g. int age; int sum, average; Use meaningful names ! C Language: Introduction

C Language: Introduction Statement Basics Assignment indicated with ‘=‘ e.g. sum = 5 + 4; sum = myage + your age; age = age + 1; Note: each statement ends in a semicolon‘;’ = does not mean arithmetic equality C Language: Introduction

C Language: Introduction C Source File // a simple program that prints // the number of fruit #include <stdio.h> main() { int oranges; int apples; int fruit; oranges = 5; apples = 17; fruit = oranges + apples; printf(“We have %d pieces of fruit”, fruit); } fruit.c C Language: Introduction

C Language: Introduction Let’s Get Started Do Hello World program together Exercises listed on web C Language: Introduction