Your first C and C++ programs

Size: px
Start display at page:

Download "Your first C and C++ programs"

Transcription

1 Your first C and C++ programs Professor Hugh C. Lauer CS-2303, System Programming Concepts (Slides include materials from The C Programming Language, 2 nd edition, by Kernighan and Ritchie, Absolute C++, by Walter Savitch, The C++ Programming Language, Special Edition, by Bjarne Stroustrup, and from C: How to Program, 5 th and 6 th editions, by Deitel and Deitel) 1

2 Your first C program /* * helloworld.c - "hello, world" program */ #include <stdio.h> int main (void) { printf( Hello, World!\n ); return 0; } CS-2303, A-Term 2012 Your first C and C++ programs 2

3 Your first C program (continued) /* * helloworld.c - "hello, world" program */ #include <stdio.h> int main (void) { printf( Hello, World!\n ); return 0; } A comment: Surrounded by /* and */ or // to end of line Same as in Java CS-2303, A-Term 2012 Your first C and C++ programs 3

4 Your first C program (continued) /* * helloworld.c - "hello, world" program */ #include <stdio.h> int main (void) { printf( Hello, World!\n ); return 0; } main must return zero if successful, otherwise some non-zero value so OS can recognize an error A function definition Note: by convention, operating system invokes function named main to start a program. CS-2303, A-Term 2012 Your first C and C++ programs 4

5 Your first C program (continued) /* * helloworld.c - "hello, world" program */ #include <stdio.h> int main (void) { printf( Hello, World!\n ); return 0; } main must return zero if successful, otherwise some non-zero value so OS can recognize an error (arguments to main to be discussed later in course) A function definition Note: by convention, operating system invokes function named main to start a program. CS-2303, A-Term 2012 Your first C and C++ programs 5

6 Your first C program (continued) /* * helloworld.c - "hello, world" program */ #include <stdio.h> int main (void) { printf( Hello, World!\n ); return 0; } Question: where is printf declared? printf A call to the C library function to format and print a string of text See K & R 1.1, 1.2, 1.5.3, and 7.2 CS-2303, A-Term 2012 Your first C and C++ programs 6

7 Your first C program (continued) /* * helloworld.c - "hello, world" program */ #include <stdio.h> Answer: In this file! int main (void) { printf( Hello, World!\n ); return 0; } Major difference from Java An include file in C or C++ (a.k.a. a header file ) is a text file declaring a bunch of stuff that is provided elsewhere! o E.g., in libraries OR in other C programs (i.e., modules) that you create Copied bodily into your program as first step of compilation! CS-2303, A-Term 2012 Your first C and C++ programs 7

8 Questions? 8

9 Your first C++ program Note file extension An include file (as in C) // helloworld.cpp #include <iostream> int main(void) { std::cout << Hello World! << std::endl; return 0; } A (static) object of the standard class ostream which is a subclass of iostream CS-2303, A-Term 2012 Your first C and C++ programs 9

10 Your first C++ program (continued) // helloworld.cpp #include <iostream> int main(void) { std::cout << Hello World! << std::endl; return 0; } The left shift operator applied to an ostream object and a string constant Another left shift operator, applied to the constant endl (defined in iostream) CS-2303, A-Term 2012 Your first C and C++ programs 10

11 Your first C++ program (continued) // helloworld.cpp #include <iostream> int main(void) { std::cout << Hello World! << std::endl; return 0; } The scope resolution operator Provides access to names declared in a class CS-2303, A-Term 2012 Your first C and C++ programs 11

12 Questions? 12

13 What happens to your code after it has been compiled but before it runs? 13

14 Compilation (part 1) HelloWorld.c Preprocessor Modifies the source code Creates internal data structure representing the program Language translator Code generator & optimizer Generates machine code HelloWorld.o However, program is not yet ready to execute! 14

15 Compilation (continued) gcc HelloWorld.c Preprocessor Translator Code gen & opt. HelloWorld.o gcc printf.c Preprocessor Translator Code gen & opt. printf.o ar (i.e., archive) Linker (part of gcc) Library of.o files for common routines a.out (or file name of your command or program) Note: this topic is developed in greater detail in CS-2011 Loader (part of OS) Memory 15

16 Questions? 16

17 Laboratory Assignment #1 Wednesday, August 29 Edit, compile, and run both Hello, World! programs I.e., in C and C++ On CCC Linux Use gcc for compiler Also, write a short program to do a simple numerical calculation Based on your knowledge of Java If time, work on Programming Assignment #1 Due Friday, August 31 17

18 Extra Laboratory Credit IF you already know how to do the laboratory AND and IF you have already submitted the required solution to Turnin you may earn extra laboratory credit by helping the TAs help others Speak to the TAs to take advantage of this 18

19 Questions? 19

Accessing Files in C. Professor Hugh C. Lauer CS-2303, System Programming Concepts

Accessing Files in C. Professor Hugh C. Lauer CS-2303, System Programming Concepts Accessing Files in C Professor Hugh C. Lauer CS-2303, System Programming Concepts (Slides include materials from The C Programming Language, 2 nd edition, by Kernighan and Ritchie, Absolute C++, by Walter

More information

Classes, Constructors, etc., in C++

Classes, Constructors, etc., in C++ Classes, Constructors, etc., in C++ Professor Hugh C. Lauer CS-2303, System Programming Concepts (Slides include materials from The C Programming Language, 2 nd edition, by Kernighan and Ritchie, Absolute

More information

Strings and Streams. Professor Hugh C. Lauer CS-2303, System Programming Concepts

Strings and Streams. Professor Hugh C. Lauer CS-2303, System Programming Concepts Strings and Streams Professor Hugh C. Lauer CS-2303, System Programming Concepts (Slides include materials from The C Programming Language, 2 nd edition, by Kernighan and Ritchie, Absolute C++, by Walter

More information

Introduction to C++ Professor Hugh C. Lauer CS-2303, System Programming Concepts

Introduction to C++ Professor Hugh C. Lauer CS-2303, System Programming Concepts Introduction to C++ Professor Hugh C. Lauer CS-2303, System Programming Concepts (Slides include materials from The C Programming Language, 2 nd edition, by Kernighan and Ritchie, Absolute C++, by Walter

More information

Linked Lists in C and C++

Linked Lists in C and C++ Linked Lists in C and C++ Professor Hugh C. Lauer CS-2303, System Programming Concepts (Slides include materials from The C Programming Language, 2 nd edition, by Kernighan and Ritchie, Absolute C++, by

More information

Exception Handling in C++

Exception Handling in C++ Exception Handling in C++ Professor Hugh C. Lauer CS-2303, System Programming Concepts (Slides include materials from The C Programming Language, 2 nd edition, by Kernighan and Ritchie, Absolute C++, by

More information

Templates (again) Professor Hugh C. Lauer CS-2303, System Programming Concepts

Templates (again) Professor Hugh C. Lauer CS-2303, System Programming Concepts Templates (again) Professor Hugh C. Lauer CS-2303, System Programming Concepts (Slides include materials from The C Programming Language, 2 nd edition, by Kernighan and Ritchie, Absolute C++, by Walter

More information

Programming Assignment #4 Binary Trees in C++

Programming Assignment #4 Binary Trees in C++ Programming Assignment #4 Binary Trees in C++ Professor Hugh C. Lauer CS-2303, System Programming Concepts (Slides include materials from The C Programming Language, 2 nd edition, by Kernighan and Ritchie,

More information

Containers and the Standard Template Library (STL)

Containers and the Standard Template Library (STL) Containers and the Standard Template Library (STL) Professor Hugh C. Lauer CS-2303, System Programming Concepts (Slides include materials from The C Programming Language, 2 nd edition, by Kernighan and

More information

A Deeper Look at Classes

A Deeper Look at Classes A Deeper Look at Classes Professor Hugh C. Lauer CS-2303, System Programming Concepts (Slides include materials from The C Programming Language, 2 nd edition, by Kernighan and Ritchie, Absolute C++, by

More information

Derived Classes in C++

Derived Classes in C++ Derived Classes in C++ Professor Hugh C. Lauer CS-2303, System Programming Concepts (Slides include materials from The C Programming Language, 2 nd edition, by Kernighan and Ritchie, Absolute C++, by Walter

More information

KYC - Know your compiler. Introduction to GCC

KYC - Know your compiler. Introduction to GCC KYC - Know your compiler Introduction to GCC The Operating System User User 1 General Purpose or Application Specific Software Operating System Kernel Computer Hardware User 2 What is GCC? GCC is the GNU

More information

Announcements. CSCI 334: Principles of Programming Languages. Lecture 18: C/C++ Announcements. Announcements. Instructor: Dan Barowy

Announcements. CSCI 334: Principles of Programming Languages. Lecture 18: C/C++ Announcements. Announcements. Instructor: Dan Barowy CSCI 334: Principles of Programming Languages Lecture 18: C/C++ Homework help session will be tomorrow from 7-9pm in Schow 030A instead of on Thursday. Instructor: Dan Barowy HW6 and HW7 solutions We only

More information

Iterators. Professor Hugh C. Lauer CS-2303, System Programming Concepts

Iterators. Professor Hugh C. Lauer CS-2303, System Programming Concepts Iterators Professor Hugh C. Lauer CS-2303, System Programming Concepts (Slides include materials from The C Programming Language, 2 nd edition, by Kernighan and Ritchie, Absolute C++, by Walter Savitch,

More information

Arrays and Pointers in C & C++

Arrays and Pointers in C & C++ Arrays and Pointers in C & C++ Professor Hugh C. Lauer CS-2303, System Programming Concepts (Slides include materials from The C Programming Language, 2 nd edition, by Kernighan and Ritchie, Absolute C++,

More information

CE221 Programming in C++ Part 1 Introduction

CE221 Programming in C++ Part 1 Introduction CE221 Programming in C++ Part 1 Introduction 06/10/2017 CE221 Part 1 1 Module Schedule There are two lectures (Monday 13.00-13.50 and Tuesday 11.00-11.50) each week in the autumn term, and a 2-hour lab

More information

Dynamic Memory Allocation (and Multi-Dimensional Arrays)

Dynamic Memory Allocation (and Multi-Dimensional Arrays) Dynamic Memory Allocation (and Multi-Dimensional Arrays) Professor Hugh C. Lauer CS-2303, System Programming Concepts (Slides include materials from The C Programming Language, 2 nd edition, by Kernighan

More information

Introduction to C++ Introduction to C++ 1

Introduction to C++ Introduction to C++ 1 1 What Is C++? (Mostly) an extension of C to include: Classes Templates Inheritance and Multiple Inheritance Function and Operator Overloading New (and better) Standard Library References and Reference

More information

Binary Trees (and Big O notation)

Binary Trees (and Big O notation) Binary Trees (and Big O notation) Professor Hugh C. Lauer CS-2303, System Programming Concepts (Slides include materials from The C Programming Language, 2 nd edition, by Kernighan and Ritchie, Absolute

More information

ENERGY 211 / CME 211. Evolution

ENERGY 211 / CME 211. Evolution ENERGY 211 / CME 211 Lecture 2 September 24, 2008 1 Evolution In the beginning, we all used assembly That was too tedious, so a very crude compiler for FORTRAN was built FORTRAN was still too painful to

More information

CS240: Programming in C

CS240: Programming in C CS240: Programming in C Lecture 2: Hello World! Cristina Nita-Rotaru Lecture 2/ Fall 2013 1 Introducing C High-level programming language Developed between 1969 and 1973 by Dennis Ritchie at the Bell Labs

More information

Structures, Unions, and Typedefs

Structures, Unions, and Typedefs Structures, Unions, and Typedefs Professor Hugh C. Lauer CS-2303, System Programming Concepts (Slides include materials from The C Programming Language, 2 nd edition, by Kernighan and Ritchie, Absolute

More information

Slide Set 5. for ENCM 339 Fall Steve Norman, PhD, PEng. Electrical & Computer Engineering Schulich School of Engineering University of Calgary

Slide Set 5. for ENCM 339 Fall Steve Norman, PhD, PEng. Electrical & Computer Engineering Schulich School of Engineering University of Calgary Slide Set 5 for ENCM 339 Fall 2016 Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary October 2016 ENCM 339 Fall 2016 Slide Set 5 slide 2/32

More information

CSE 374 Programming Concepts & Tools. Hal Perkins Spring 2010

CSE 374 Programming Concepts & Tools. Hal Perkins Spring 2010 CSE 374 Programming Concepts & Tools Hal Perkins Spring 2010 Lecture 19 Introduction ti to C++ C++ C++ is an enormous language: g All of C Classes and objects (kind of like Java, some crucial differences)

More information

CS11 Intro C++ Spring 2018 Lecture 1

CS11 Intro C++ Spring 2018 Lecture 1 CS11 Intro C++ Spring 2018 Lecture 1 Welcome to CS11 Intro C++! An introduction to the C++ programming language and tools Prerequisites: CS11 C track, or equivalent experience with a curly-brace language,

More information

Strings in C. Professor Hugh C. Lauer CS-2303, System Programming Concepts

Strings in C. Professor Hugh C. Lauer CS-2303, System Programming Concepts Strings in C Professor Hugh C. Lauer CS-2303, System Programming Concepts (Slides include materials from The C Programming Language, 2 nd edition, by Kernighan and Ritchie, Absolute C++, by Walter Savitch,

More information

6.S096 Lecture 1 Introduction to C

6.S096 Lecture 1 Introduction to C 6.S096 Lecture 1 Introduction to C Welcome to the Memory Jungle Andre Kessler January 8, 2014 Andre Kessler 6.S096 Lecture 1 Introduction to C January 8, 2014 1 / 26 Outline 1 Motivation 2 Class Logistics

More information

CSE 303: Concepts and Tools for Software Development

CSE 303: Concepts and Tools for Software Development CSE 303: Concepts and Tools for Software Development Hal Perkins Autumn 2008 Lecture 24 Introduction to C++ CSE303 Autumn 2008, Lecture 24 1 C++ C++ is an enormous language: All of C Classes and objects

More information

6.S096 Lecture 4 Style and Structure

6.S096 Lecture 4 Style and Structure 6.S096 Lecture 4 Style and Structure Transition from C to C++ Andre Kessler Andre Kessler 6.S096 Lecture 4 Style and Structure 1 / 24 Outline 1 Assignment Recap 2 Headers and multiple files 3 Coding style

More information

CSE 374 Programming Concepts & Tools. Hal Perkins Fall 2015 Lecture 19 Introduction to C++

CSE 374 Programming Concepts & Tools. Hal Perkins Fall 2015 Lecture 19 Introduction to C++ CSE 374 Programming Concepts & Tools Hal Perkins Fall 2015 Lecture 19 Introduction to C++ C++ C++ is an enormous language: All of C Classes and objects (kind of like Java, some crucial differences) Many

More information

Spring 2018 NENG 202 Introduction to Computer Programming

Spring 2018 NENG 202 Introduction to Computer Programming Spring 2018 NENG 202 Introduction to Computer Programming Introductory programming course based on the C language Course Website: http://www.albany.edu/~yx152122/neng202-18.html Instructor: Prof. Y. Alex

More information

(Extract from the slides by Terrance E. Boult

(Extract from the slides by Terrance E. Boult What software engineers need to know about linking and a few things about execution (Extract from the slides by Terrance E. Boult http://vast.uccs.edu/~tboult/) A Simplistic Program Translation Scheme

More information

CS 61C: Great Ideas in Computer Architecture Introduction to C

CS 61C: Great Ideas in Computer Architecture Introduction to C CS 61C: Great Ideas in Computer Architecture Introduction to C Instructors: Vladimir Stojanovic & Nicholas Weaver http://inst.eecs.berkeley.edu/~cs61c/ 1 Agenda C vs. Java vs. Python Quick Start Introduction

More information

CSCI 2132: Software Development. Norbert Zeh. Faculty of Computer Science Dalhousie University. Introduction to C. Winter 2019

CSCI 2132: Software Development. Norbert Zeh. Faculty of Computer Science Dalhousie University. Introduction to C. Winter 2019 CSCI 2132: Software Development Introduction to C Norbert Zeh Faculty of Computer Science Dalhousie University Winter 2019 The C Programming Language Originally invented for writing OS and other system

More information

Crash Course into. Prof. Dr. Renato Pajarola

Crash Course into. Prof. Dr. Renato Pajarola Crash Course into Prof. Dr. Renato Pajarola These slides may not be copied or distributed without explicit permission by all original copyright holders C Language Low-level programming language General

More information

EL2310 Scientific Programming

EL2310 Scientific Programming Lecture 6: Introduction to C (pronobis@kth.se) Overview Overview Lecture 6: Introduction to C Roots of C Getting started with C Closer look at Hello World Programming Environment Schedule Last time (and

More information

Programmazione. Prof. Marco Bertini

Programmazione. Prof. Marco Bertini Programmazione Prof. Marco Bertini marco.bertini@unifi.it http://www.micc.unifi.it/bertini/ Hello world : a review Some differences between C and C++ Let s review some differences between C and C++ looking

More information

Introduction to C CMSC 104 Spring 2014, Section 02, Lecture 6 Jason Tang

Introduction to C CMSC 104 Spring 2014, Section 02, Lecture 6 Jason Tang Introduction to C CMSC 104 Spring 2014, Section 02, Lecture 6 Jason Tang Topics History of Programming Languages Compilation Process Anatomy of C CMSC 104 Coding Standards Machine Code In the beginning,

More information

C - Basics, Bitwise Operator. Zhaoguo Wang

C - Basics, Bitwise Operator. Zhaoguo Wang C - Basics, Bitwise Operator Zhaoguo Wang Java is the best language!!! NO! C is the best!!!! Languages C Java Python 1972 1995 2000 (2.0) Procedure Object oriented Procedure & object oriented Compiled

More information

CS240: Programming in C. Lecture 2: Overview

CS240: Programming in C. Lecture 2: Overview CS240: Programming in C Lecture 2: Overview 1 Programming Model How does C view the world? Stack Memory code Globals 2 Programming Model Execution mediated via a stack function calls and returns local

More information

EP241 Computer Programming

EP241 Computer Programming EP241 Computer Programming Topic 1 Dr. Ahmet BİNGÜL Department of Engineering Physics University of Gaziantep Modifications by Dr. Andrew BEDDALL Department of Electric and Electronics Engineering Sep

More information

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #54. Organizing Code in multiple files

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #54. Organizing Code in multiple files Introduction to Programming in C Department of Computer Science and Engineering Lecture No. #54 Organizing Code in multiple files (Refer Slide Time: 00:09) In this lecture, let us look at one particular

More information

Welcome to MCS 360. content expectations. using g++ input and output streams the namespace std. Euclid s algorithm the while and do-while statements

Welcome to MCS 360. content expectations. using g++ input and output streams the namespace std. Euclid s algorithm the while and do-while statements Welcome to MCS 360 1 About the Course content expectations 2 our first C++ program using g++ input and output streams the namespace std 3 Greatest Common Divisor Euclid s algorithm the while and do-while

More information

C, C++, Fortran: Basics

C, C++, Fortran: Basics C, C++, Fortran: Basics Bruno Abreu Calfa Last Update: September 27, 2011 Table of Contents Outline Contents 1 Introduction and Requirements 1 2 Basic Programming Elements 2 3 Application: Numerical Linear

More information

C: Program Structure. Department of Computer Science College of Engineering Boise State University. September 11, /13

C: Program Structure. Department of Computer Science College of Engineering Boise State University. September 11, /13 Department of Computer Science College of Engineering Boise State University September 11, 2017 1/13 Scope Variables and functions are visible from the point they are defined until the end of the source

More information

CS 376b Computer Vision

CS 376b Computer Vision CS 376b Computer Vision 09 / 25 / 2014 Instructor: Michael Eckmann Today s Topics Questions? / Comments? Enhancing images / masks Cross correlation Convolution C++ Cross-correlation Cross-correlation involves

More information

Course Information and Introduction

Course Information and Introduction August 22, 2017 Course Information 1 Instructors : Email : arash.rafiey@indstate.edu Office : Root Hall A-127 Office Hours : Tuesdays 11:30 pm 12:30 pm. Root Hall, A127. 2 Course Home Page : http://cs.indstate.edu/~arash/cs256.html

More information

Chapter 1 Introduction to Computers and C++ Programming

Chapter 1 Introduction to Computers and C++ Programming Chapter 1 Introduction to Computers and C++ Programming 1 Outline 1.1 Introduction 1.2 What is a Computer? 1.3 Computer Organization 1.7 History of C and C++ 1.14 Basics of a Typical C++ Environment 1.20

More information

Hello, World! in C. Johann Myrkraverk Oskarsson October 23, The Quintessential Example Program 1. I Printing Text 2. II The Main Function 3

Hello, World! in C. Johann Myrkraverk Oskarsson October 23, The Quintessential Example Program 1. I Printing Text 2. II The Main Function 3 Hello, World! in C Johann Myrkraverk Oskarsson October 23, 2018 Contents 1 The Quintessential Example Program 1 I Printing Text 2 II The Main Function 3 III The Header Files 4 IV Compiling and Running

More information

Welcome to... CS113: Introduction to C

Welcome to... CS113: Introduction to C Welcome to... CS113: Introduction to C Instructor: Erik Sherwood E-mail: wes28@cs.cornell.edu Course Website: http://www.cs.cornell.edu/courses/cs113/2005fa/ The website is linked to from the courses page

More information

COSC350 System Software

COSC350 System Software COSC350 System Software Topics: The UNIX/Linux Operating System Basics UNIX/Linux basic commands, login scripts and environment set up, C programming environment, introduction to basic shell scripts Working

More information

EC 413 Computer Organization

EC 413 Computer Organization EC 413 Computer Organization C/C++ Language Review Prof. Michel A. Kinsy Programming Languages There are many programming languages available: Pascal, C, C++, Java, Ada, Perl and Python All of these languages

More information

ANSI C. Data Analysis in Geophysics Demián D. Gómez November 2013

ANSI C. Data Analysis in Geophysics Demián D. Gómez November 2013 ANSI C Data Analysis in Geophysics Demián D. Gómez November 2013 ANSI C Standards published by the American National Standards Institute (1983-1989). Initially developed by Dennis Ritchie between 1969

More information

CS 253: Intro to Systems Programming 1/21

CS 253: Intro to Systems Programming 1/21 1/21 Topics Intro to Team-Based Learning (TBL) Syllabus and class logistics What is Systems? 2/21 Team-Based Learning Evidence-based instructional practice proven to increase student motivation and comprehension.

More information

Tutorial-2a: First steps with C++ programming

Tutorial-2a: First steps with C++ programming Programming for Scientists Tutorial 2a 1 / 18 HTTP://WWW.HEP.LU.SE/COURSES/MNXB01 Introduction to Programming and Computing for Scientists Tutorial-2a: First steps with C++ programming Programming for

More information

CSE 303 Lecture 8. Intro to C programming

CSE 303 Lecture 8. Intro to C programming CSE 303 Lecture 8 Intro to C programming read C Reference Manual pp. Ch. 1, 2.2-2.4, 2.6, 3.1, 5.1, 7.1-7.2, 7.5.1-7.5.4, 7.6-7.9, Ch. 8; Programming in C Ch. 1-6 slides created by Marty Stepp http://www.cs.washington.edu/303/

More information

C-Programming. CSC209: Software Tools and Systems Programming. Paul Vrbik. University of Toronto Mississauga

C-Programming. CSC209: Software Tools and Systems Programming. Paul Vrbik. University of Toronto Mississauga C-Programming CSC209: Software Tools and Systems Programming Paul Vrbik University of Toronto Mississauga https://mcs.utm.utoronto.ca/~209/ Adapted from Dan Zingaro s 2015 slides. Week 2.0 1 / 19 What

More information

Unit 1: Introduction to C Language. Saurabh Khatri Lecturer Department of Computer Technology VIT, Pune

Unit 1: Introduction to C Language. Saurabh Khatri Lecturer Department of Computer Technology VIT, Pune Unit 1: Introduction to C Language Saurabh Khatri Lecturer Department of Computer Technology VIT, Pune Introduction to C Language The C programming language was designed by Dennis Ritchie at Bell Laboratories

More information

Cours de C++ Introduction

Cours de C++ Introduction Cours de C++ Introduction Cécile Braunstein cecile.braunstein@lip6.fr Cours de C++ 1 / 20 Généralité Notes Interros cours 1/3 Contrôle TP 1/3 Mini-projet 1/3 Bonus (Note de Participation) jusqu à 2 points

More information

Software Lesson 1 Outline

Software Lesson 1 Outline Software Lesson 1 Outline 1. Software Lesson 1 Outline 2. What is Software? A Program? Data? 3. What are Instructions? 4. What is a Programming Language? 5. What is Source Code? What is a Source File?

More information

Work relative to other classes

Work relative to other classes Work relative to other classes 1 Hours/week on projects 2 C BOOTCAMP DAY 1 CS3600, Northeastern University Slides adapted from Anandha Gopalan s CS132 course at Univ. of Pittsburgh Overview C: A language

More information

ENCE Computer Organization and Architecture. Chapter 1. Software Perspective

ENCE Computer Organization and Architecture. Chapter 1. Software Perspective Computer Organization and Architecture Chapter 1 Software Perspective The Lifetime of a Simple Program A Simple Program # include int main() { printf( hello, world\n ); } The goal of this course

More information

CPS1011. Program Structure {C};

CPS1011. Program Structure {C}; CPS1011 Program Structure {C}; Content Basic Constructs Statements Keywords Identifiers Operators Data Debugging CPS1011 2/18 Basic Constructs (i) Preprocessor directives e.g. #include Text merge

More information

CS 241 Data Organization. August 21, 2018

CS 241 Data Organization. August 21, 2018 CS 241 Data Organization August 21, 2018 Contact Info Instructor: Dr. Marie Vasek Contact: Private message me on the course Piazza page. Office: Room 2120 of Farris Web site: www.cs.unm.edu/~vasek/cs241/

More information

Multimedia-Programmierung Übung 3

Multimedia-Programmierung Übung 3 Multimedia-Programmierung Übung 3 Ludwig-Maximilians-Universität München Sommersemester 2016 Ludwig-Maximilians-Universität München Multimedia-Programmierung 1-1 Today Ludwig-Maximilians-Universität München

More information

Introduction to Programming

Introduction to Programming Introduction to Programming session 5 Instructor: Reza Entezari-Maleki Email: entezari@ce.sharif.edu 1 Fall 2010 These slides are created using Deitel s slides Sahrif University of Technology Outlines

More information

CS201 - Introduction to Programming FAQs By

CS201 - Introduction to Programming FAQs By CS201 - Introduction to Programming FAQs By What are pointers? Answer: A pointer is a variable that represents/stores location of a data item, such as a variable or array element What s the difference

More information

Structure of this course. C and C++ Past Exam Questions. Text books

Structure of this course. C and C++ Past Exam Questions. Text books Structure of this course C and C++ 1. Types Variables Expressions & Statements Alastair R. Beresford University of Cambridge Lent Term 2008 Programming in C: types, variables, expressions & statements

More information

CS133 C Programming. Instructor: Jialiang Lu Office: Information Center 703

CS133 C Programming. Instructor: Jialiang Lu   Office: Information Center 703 CS133 C Programming Instructor: Jialiang Lu Email: jialiang.lu@sjtu.edu.cn Office: Information Center 703 1 Course Information: Course Page: http://wirelesslab.sjtu.edu.cn/~jlu/teaching/cp2014/ Assignments

More information

CS 261 Fall C Introduction. Variables, Memory Model, Pointers, and Debugging. Mike Lam, Professor

CS 261 Fall C Introduction. Variables, Memory Model, Pointers, and Debugging. Mike Lam, Professor CS 261 Fall 2017 Mike Lam, Professor C Introduction Variables, Memory Model, Pointers, and Debugging The C Language Systems language originally developed for Unix Imperative, compiled language with static

More information

Computers and Computation. The Modern Computer. The Operating System. The Operating System

Computers and Computation. The Modern Computer. The Operating System. The Operating System The Modern Computer Computers and Computation What is a computer? A machine that manipulates data according to instructions. Despite their apparent complexity, at the lowest level computers perform simple

More information

AN OVERVIEW OF C. CSE 130: Introduction to Programming in C Stony Brook University

AN OVERVIEW OF C. CSE 130: Introduction to Programming in C Stony Brook University AN OVERVIEW OF C CSE 130: Introduction to Programming in C Stony Brook University WHY C? C is a programming lingua franca Millions of lines of C code exist Many other languages use C-like syntax C is portable

More information

Lab 1: First Steps in C++ - Eclipse

Lab 1: First Steps in C++ - Eclipse Lab 1: First Steps in C++ - Eclipse Step Zero: Select workspace 1. Upon launching eclipse, we are ask to chose a workspace: 2. We select a new workspace directory (e.g., C:\Courses ): 3. We accept the

More information

Distributed Real-Time Control Systems. Lecture 17 C++ Programming Intro to C++ Objects and Classes

Distributed Real-Time Control Systems. Lecture 17 C++ Programming Intro to C++ Objects and Classes Distributed Real-Time Control Systems Lecture 17 C++ Programming Intro to C++ Objects and Classes 1 Bibliography Classical References Covers C++ 11 2 What is C++? A computer language with object oriented

More information

Intermediate Programming, Spring 2017*

Intermediate Programming, Spring 2017* 600.120 Intermediate Programming, Spring 2017* Misha Kazhdan *Much of the code in these examples is not commented because it would otherwise not fit on the slides. This is bad coding practice in general

More information

University of Colorado at Colorado Springs CS4500/ Fall 2018 Operating Systems Project 1 - System Calls and Processes

University of Colorado at Colorado Springs CS4500/ Fall 2018 Operating Systems Project 1 - System Calls and Processes University of Colorado at Colorado Springs CS4500/5500 - Fall 2018 Operating Systems Project 1 - System Calls and Processes Instructor: Yanyan Zhuang Total Points: 100 Out: 8/29/2018 Due: 11:59 pm, Friday,

More information

EL2310 Scientific Programming

EL2310 Scientific Programming (yaseminb@kth.se) Overview Overview Roots of C Getting started with C Closer look at Hello World Programming Environment Discussion Basic Datatypes and printf Schedule Introduction to C - main part of

More information

Exercise 1.1 Hello world

Exercise 1.1 Hello world Exercise 1.1 Hello world The goal of this exercise is to verify that computer and compiler setup are functioning correctly. To verify that your setup runs fine, compile and run the hello world example

More information

Programming in C and C++

Programming in C and C++ Programming in C and C++ 1. Types Variables Expressions & Statements Dr. Anil Madhavapeddy University of Cambridge (based on previous years thanks to Alan Mycroft, Alastair Beresford and Andrew Moore)

More information

by Pearson Education, Inc. All Rights Reserved.

by Pearson Education, Inc. All Rights Reserved. Programmers write instructions in various programming languages, some directly understandable by computers and others requiring intermediate translation steps. Computer languages may be divided into three

More information

Programming in C and C++

Programming in C and C++ Programming in C and C++ Types, Variables, Expressions and Statements Neel Krishnaswami and Alan Mycroft Course Structure Basics of C: Types, variables, expressions and statements Functions, compilation

More information

Compiler Drivers = GCC

Compiler Drivers = GCC Compiler Drivers = GCC When you invoke GCC, it normally does preprocessing, compilation, assembly and linking, as needed, on behalf of the user accepts options and file names as operands % gcc O1 -g -o

More information

Embedded Systems Programming

Embedded Systems Programming Embedded Systems Programming ES Development Environment (Module 3) Yann-Hang Lee Arizona State University yhlee@asu.edu (480) 727-7507 Summer 2014 Embedded System Development Need a real-time (embedded)

More information

(heavily based on last year s notes (Andrew Moore) with thanks to Alastair R. Beresford. 1. Types Variables Expressions & Statements 2/23

(heavily based on last year s notes (Andrew Moore) with thanks to Alastair R. Beresford. 1. Types Variables Expressions & Statements 2/23 Structure of this course Programming in C: types, variables, expressions & statements functions, compilation, pre-processor pointers, structures extended examples, tick hints n tips Programming in C++:

More information

ITC213: STRUCTURED PROGRAMMING. Bhaskar Shrestha National College of Computer Studies Tribhuvan University

ITC213: STRUCTURED PROGRAMMING. Bhaskar Shrestha National College of Computer Studies Tribhuvan University ITC213: STRUCTURED PROGRAMMING Bhaskar Shrestha National College of Computer Studies Tribhuvan University Lecture 04: Introduction to C Readings: Chapter 1.5-1.7 What is C? C is a general-purpose, structured

More information

Beyond this course. Machine code. Readings: CP:AMA 2.1, 15.4

Beyond this course. Machine code. Readings: CP:AMA 2.1, 15.4 Beyond this course Readings: CP:AMA 2.1, 15.4 CS 136 Spring 2018 13: Beyond 1 Machine code In Section 04 we briefly discussed compiling: converting source code into machine code so it can be run or executed.

More information

COMP322 - Introduction to C++ Lecture 01 - Introduction

COMP322 - Introduction to C++ Lecture 01 - Introduction COMP322 - Introduction to C++ Lecture 01 - Introduction Robert D. Vincent School of Computer Science 6 January 2010 What this course is Crash course in C++ Only 14 lectures Single-credit course What this

More information

Problem Set 1: Unix Commands 1

Problem Set 1: Unix Commands 1 Problem Set 1: Unix Commands 1 WARNING: IF YOU DO NOT FIND THIS PROBLEM SET TRIVIAL, I WOULD NOT RECOMMEND YOU TAKE THIS OFFERING OF 300 AS YOU DO NOT POSSESS THE REQUISITE BACKGROUND TO PASS THE COURSE.

More information

CSI33 Data Structures

CSI33 Data Structures Outline Department of Mathematics and Computer Science Bronx Community College October 22, 2018 Outline Outline 1 Chapter 8: A C++ Introduction For Python Programmers ords Data Types And Variable Declarations

More information

PROGRAMMAZIONE I A.A. 2017/2018

PROGRAMMAZIONE I A.A. 2017/2018 PROGRAMMAZIONE I A.A. 2017/2018 PROGRAMMING LANGUAGES A programming language is a formal language that specifies a set of instructions that can be used to produce various kinds of output. Programming languages

More information

EECS2031 Software Tools

EECS2031 Software Tools EECS2031 Software Tools SU 2014-2015 The Course EECS2031 Software Tools Lecture: R N203. Tuesdays 18:00 20:00 Labs: LAS (CSEB) 1006 Lab 01 Tuesdays 16:00 18: 00 Lab 02 Wednesdays 17:00 19:00 Course website:

More information

Introduction. Instructor: Jia Xu CSCI-135

Introduction. Instructor: Jia Xu CSCI-135 Introduction Instructor: Jia Xu CSCI-135 about 135 prerequisite: CSCI-127 final score: 25% programming projects (3-5) late penalty on programming projects (see b.b.) 75% three tests (equally weighted)

More information

COMP1917: Computing 1 1. Introduction

COMP1917: Computing 1 1. Introduction COMP1917: Computing 1 1. Introduction Reading: Moffat, Chapter 1. COMP1917 12s2 Introduction 1 Course Web Site http://www.cse.unsw.edu.au/~cs1917/12s2 Please check this Web Site regularly for updated information,

More information

C Introduction. Comparison w/ Java, Memory Model, and Pointers

C Introduction. Comparison w/ Java, Memory Model, and Pointers CS 261 Fall 2018 Mike Lam, Professor C Introduction Comparison w/ Java, Memory Model, and Pointers Please go to socrative.com on your phone or laptop, choose student login and join room LAMJMU The C Language

More information

COMP1917: Computing 1 1. Introduction

COMP1917: Computing 1 1. Introduction COMP1917: Computing 1 1. Introduction Reading: Moffat, Chapter 1. COMP1917 15s2 Introduction 1 Course Web Site http://www.cse.unsw.edu.au/~cs1917/15s2 Please check this Web Site regularly for updated information,

More information

A software view. Computer Systems. The Compilation system. How it works. 1. Preprocesser. 1. Preprocessor (cpp)

A software view. Computer Systems. The Compilation system. How it works. 1. Preprocesser. 1. Preprocessor (cpp) A software view User Interface Computer Systems MTSU CSCI 3240 Spring 2016 Dr. Hyrum D. Carroll Materials from CMU and Dr. Butler How it works hello.c #include int main() { printf( hello, world\n

More information

2 Compiling a C program

2 Compiling a C program 2 Compiling a C program This chapter describes how to compile C programs using gcc. Programs can be compiled from a single source file or from multiple source files, and may use system libraries and header

More information

Design and development of embedded systems for the Internet of Things (IoT) Fabio Angeletti Fabrizio Gattuso

Design and development of embedded systems for the Internet of Things (IoT) Fabio Angeletti Fabrizio Gattuso Design and development of embedded systems for the Internet of Things (IoT) Fabio Angeletti Fabrizio Gattuso Why C? Test on 21 Android Devices with 32-bits and 64-bits processors and different versions

More information

CS 220: Introduction to Parallel Computing. Beginning C. Lecture 2

CS 220: Introduction to Parallel Computing. Beginning C. Lecture 2 CS 220: Introduction to Parallel Computing Beginning C Lecture 2 Today s Schedule More C Background Differences: C vs Java/Python The C Compiler HW0 8/25/17 CS 220: Parallel Computing 2 Today s Schedule

More information