CSE 2541 – Advanced C Programming Instructor: Yang Zhang

Slides:



Advertisements
Similar presentations
INTRODUCTION T.Najah Al_Subaie Kingdom of Saudi Arabia Prince Norah bint Abdul Rahman University College of Computer Since and Information System CS240.
Advertisements

COSC 120 Computer Programming
CSE1301 Computer Programming Lecture 4: C Primitives I.
Three types of computer languages
1 Lecture 1  Getting ready to program  Hardware Model  Software Model  Programming Languages  The C Language  Software Engineering  Programming.
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?
CS211 Data Structures Sami Rollins Fall 2004.
Introduction to C Programming Overview of C Hello World program Unix environment C programming basics.
Chapter 2: Impact of Machine Architectures What is the Relationship Between Programs, Programming Languages, and Computers.
1 ICS103 Programming in C Lecture 2: Introduction to C (1)
CS 101 Problem Solving and Structured Programming in C Sami Rollins Spring 2003.
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.
C programming Language and Data Structure For DIT Students.
CSE : Programming in C Instructor: Lei Wang Office: Dreese Lab 474 Office Hour: Friday.
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 Introduction to Programming. Computer Hardware CPU Memory –Main or primary –Secondary or auxiliary Input device(s) Output device(s)
C PROGRAMMING LECTURE C-language Computer Fundamentals.
 2000 Prentice Hall, Inc. All rights reserved. 1 Introduction to Computers and C Programming Outline Introduction What Is a Computer? Computer Organization.
CS 11 C track: lecture 1 Preliminaries Need a CS cluster account cgi-bin/sysadmin/account_request.cgi Need to know UNIX ITS.
Intro. to Game Programming Want to program a game?
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.
 2008 Pearson Education, Inc. All rights reserved Introduction to Computers, the Internet and World Wide Web.
Spring 2005, Gülcihan Özdemir Dağ BIL104E: Introduction to Scientific and Engineering Computing, Spring Outline 1.1Introduction 1.2What Is a Computer?
Hello World 2 What does all that mean?.
Introduction to Computer Systems Topics: Theme Four great realities of computer systems Chap 1 in “Computer Systems” book “The Class That Gives.
Introduction of C++ language. C++ Predecessors Early high level languages or programming languages were written to address a particular kind of computing.
Programming With C.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Introduction to Computers Outline 1.1Introduction.
CSE 2541 – Advanced C Programming. Course info Prereq – CSE 2221 or CSE 222 Co-req – CSE 2231 Website
1 Programming in C Hello World! Soon I will control the world! Soon I will control the world!
C Language: Introduction
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 CMSC 104, Section 4 Richard Chang 1.
Introduction to C 2008/09/29: Lecture 7 CMSC 104, Section 0101 John Y. Park 1.
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.
CS 251 C Programming for Engineers Spring 2016 Instructor: Dick Lang.
First Compilation Rudra Dutta CSC Spring 2007, Section 001.
CMPE13Cyrus Bazeghi 1 Chapter 11 Introduction to Programming in C.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Chapter 1 – Introduction to C.
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.
Chapter 11  Getting ready to program  Hardware Model  Software Model  Programming Languages  Facts about C++  Program Development Process  The Hello-world.
C Programming Lecture 3 : C Introduction 1 Lecture notes : courtesy of Woo Kyun and Chang Byung-Mo.
1 Types of Programming Language (1) Three types of programming languages 1.Machine languages Strings of numbers giving machine specific instructions Example:
Hello world !!! ASCII representation of hello.c.
L071 Introduction to C Topics Compilation Using the gcc Compiler The Anatomy of a C Program Reading Sections
小型系統 心情 vs. 古典樂 心情 vs. 古典樂 浪漫求籤系統 美食導航系統 季潔亭雅鈺熒岱芸 美食導航系統 楊氏音樂模擬大會考人瑋 若維 芷萱 伽倩 楊氏音樂模擬大會考 麥當勞熱量計算系統 火星文困擾你嗎 ? 火星文困擾你嗎 ? 歌詞知多少 - 挑戰你的腦容量英琪 日馨 青雪 鈺娟.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
Operating Systems A Biswas, Dept. of Information Technology.
CSE1301 Computer Programming Lecture 2: Introduction to C Joselito (Joey) Chua
BIL 104E Introduction to Scientific and Engineering Computing Lecture 1.
From Algorithms to Programs Both are sets of instructions on how to do a task Algorithm: –talking to humans, easy to understand –in plain (English) language.
KYC - Know your compiler Introduction to GCC
Introduction to C Topics Compilation Using the gcc Compiler
UMBC CMSC 104 – Section 01, Fall 2016
Computer Programming Techniques Semester 1, 1998
C Programming Hardik H. Maheta.
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.
History of ‘C’ Root of the morden language is ALGOL It’s first
Introduction to C Topics Compilation Using the gcc Compiler
Introduction to C Topics Compilation Using the gcc Compiler
Introduction to C Programming Language
C Programming Lecture Series
Hello World 2 What does all that mean?.
Introduction to Computer Systems
Govt. Polytechnic,Dhangar
2008/09/29: Lecture 7 CMSC 104, Section 0101 John Y. Park
Introduction to Computer Systems
Introduction to C Topics Compilation Using the gcc Compiler
Presentation transcript:

CSE 2541 – Advanced C Programming Instructor: Yang Zhang

Course info Prereq – CSE 2221 or CSE 222 Co-req – CSE 2231 Website –

Brief history of C 1970’s – Unix – C, from BCPL (Thompson and Ritchie) C programming Language – Widely used like the others: Fortran, Pascal – Main form of language for system programming – Available on any machine with C compiler and library

Why C? Popular language – Operating systems (Win, Linux, FreeBSD) – Web servers (Apache) – Web browsers (Fox) – Mail servers (sendmail, postfix) – DNS servers (bind) – Graphics card programming (OpenCL) Programming language rankings Why? – Performance – Portability – Familiar to programmers

Why C? Compared to assembly language – Abstracts the hardware view (registers, memory, call stacks), making code portable and easier – Provides variables, functions, arrays, complex arithmetic, Boolean expressions Compared to other high-level languages – Maps almost directly into hardware instructions, making optimization easier – Provides a minimal set of abstractions compared to other HLLs – Like other HLLs, makes complex programming simpler (at the expense of efficiency)

Hello World – code /* Hello World! */ #include int main() { printf(“Hello World!\n”); return 0; }

C compilation model

Hello World – walkthrough C program: hello.c – emacs, vi, vim, pico, joe … – Plaintext only Preprocessing: hello.s, assembly code – cc -S hello.c Compilation: hello.o, a binary file – cc -c hello.s Linking: a.out or hello, an executable file – cc hello.o – cc -o hello hello.o Loading (dynamical linking) and execution:./hello –./a.out –./hello

Hello World – content breakdown Comment Preprocessor directive Function definition Output statement Return clause

#include int main() { int first, second, add; float divide; printf("Enter two integers\n"); scanf("%d%d", &first, &second); add = first + second; divide = first / (float)second; printf("Sum = %d\n",add); printf("Division = %.2f\n",divide); return 0; } Second Example

Second example – content breakdown Variables Function calls – Input – Output Operators Typecasting