EPITA SPE C Workshop - D0

Size: px
Start display at page:

Download "EPITA SPE C Workshop - D0"

Transcription

1 EPITA SPE C Workshop - D0 marwan.burelle@lse.epita.fr

2 Overview 1 B, PDP And Unics From Bell s Lab To ISO normalization 2 Imperative And Structured Syntax 3 Compilers Using make Other 4 Simple Mathematical Functions Vectors 5

3 B, PDP And Unics From Bell s Lab To ISO normalization

4 Birth Of A Legend Back in the 1960 s: programming languages and operating systems was in an early state. One of the biggest project was Multics a join project between MIT, General Electric and Bell Labs. One major innovation of Multics was that is was almost completely written in an higher-level language (PL/I) Despite a lot of money and brains, Multics finally fails to meet its ambitious goals. Experience gathered when working on Multics leads Ken Thompson and Denis Ritchie from Bell s Lab to build a new operating system. You can have a first hand and detailed version of this story in [2]. B, PDP And Unics From Bell s Lab To ISO normalization

5 Overview B, PDP And Unics From Bell s Lab To ISO normalization 1 B, PDP And Unics From Bell s Lab To ISO normalization

6 From games to operating systems After implementing a game on a PDP-7, Ken Thompson realized that abstracting low-level operations in an operating system can greatly simplify applications development. Due to the lack of a proper environment on the PDP-7, the first kernel and almost all basic elements of the system was coded by Thompson using assembly. But he didn t want to be stuck with PDP assembly language. Unfortunately, most compilers was to big for the 8K bytes of memory in the PDP-7. B, PDP And Unics From Bell s Lab To ISO normalization

7 B and UNICS Thompson simplified BCPL (an imperative language from the MIT) and create a new language: B B was merely an evoluated assembly language with only one kind of values (machine words), functions and structured control flows. From 1969 to 1972, Thompson used B to implements UNICS. Evolution of the hardware and works from Denis Ritchie give birth to a new language: C. B, PDP And Unics From Bell s Lab To ISO normalization

8 After B... Denis Ritchie introduced several changes in the B programming language, among others the most important were: notion of types (char, int... ) structures (or records) a preprocessor The language evolved a lot during the 1970 s The success of Unix and related softwares (BSD distribution, Internet Protocol Stack... ) make the C programming language the most used and known programming language. Among other aspect, the choice to provide I/O operations and other interractions in external librairies rather than directly as language features were one of the reason of its popularity. B, PDP And Unics From Bell s Lab To ISO normalization

9 Overview B, PDP And Unics From Bell s Lab To ISO normalization 1 B, PDP And Unics From Bell s Lab To ISO normalization

10 Before ANSI As any research project, the first C evolved a lot, following necessity and adding features as needs arise. In 1978, Denis Ritchie and Brian Kernighan publish the first edition of the reference book [1] While this book tries to completely describe the language, several evolutions appear even before the publication of the book. Effort to make the language portable and to have a portable implementation (the pcc compiler widely used at that time) make the language evolved very fast. It seems that C needs to be unified and normalized at some points. B, PDP And Unics From Bell s Lab To ISO normalization

11 ANSI C By 1989 the ANSI published the first official C standard This stantard was accepted by ISO the following year under the reference ISO/IEC While trying to preserve compatibility with previous versions of C, it introduces a stronger notion of types (enforcing types parameters verification for external functions) and define a complete describtion of the C library. This version of C is probably the most widely used and syntactic changes introduced at that time are now considered as the standard syntax. This version is often called: ANSI C, C89 or C90 B, PDP And Unics From Bell s Lab To ISO normalization

12 Standard Library The standard defines a set of routines used for I/O, string manipulations or memory allocation. Standard Library defines (in the ANSI version) the following headers: Standard Library <assert.h> <ctype.h> <errno.h> <float.h> <iso646.h> <limits.h> <locale.h> <math.h> <setjmp.h> <signal.h> <stdarg.h> <stddef.h> <stdio.h> <stdlib.h> <string.h> <time.h> <wchar.h> <wctype.h> B, PDP And Unics From Bell s Lab To ISO normalization The standard library is also defined by POSIX, it is the same set of headers extended with Unix centric functions and system calls.

13 C99 and C11 In 1999, ISO published a newer version of the standard: C99 99 mainly extends the standard library but brought also minor language changes: Boolean type Original BCPL comments style: // The possibility to declare variables at any place in the code and not only at the begining of blocks. Variable declaration inside the for statements static inline functions Compound statement (block of statements used as expression) B, PDP And Unics From Bell s Lab To ISO normalization In 2011 a new version of the standard appears, C11, appart from various library evolution, the main and most important evolution is a new semantics adpated to parallel programming.

14 Other Extensions And Implementations The language and the standard library is extended by various organizations to fit specific needs. On Unix like systems, most people use POSIX and BSD extension to the standard library: system calls, threads management... Compiler also offers syntax extensions: attributes, intrinsic statements, inline assembly... Over the time popular extensions may be integrated in the ISO standard. Anyway, many obscure aspects of the standard are not supported by all compilers. In fact, C11 is too young to be available in actual compilers and even C99 isn t yet fully supported by any compiler (but actual support is probably largely sufficient.) B, PDP And Unics From Bell s Lab To ISO normalization

15 Imperative And Structured Syntax

16 A First Example First Example /* A simple example */ #include <stdio.h> /* Computing n! */ unsigned fact(unsigned n) { return n?n*fact(n-1):1; } Imperative And Structured Syntax int main() { printf("fact(5) = %d\n", fact(5)); return 0; }

17 Overview 2 Imperative And Structured Syntax Imperative And Structured Syntax

18 Global Overview C belongs to the family of imperative and structured languages. The outer structure of a program is a series of global variables and functions definitions (with a special function serving as entry point.) As other imperative languages expressions and statement are distinct elements. Since it s a structured language, the syntax provides various control flow operations (if, switch and various kind of loops.) The language provides also various kind of data: usual basic types (integers of different size and floating point numbers), records (called structures), union, enumeration type and a kind of array. Imperative And Structured Syntax

19 Memory Model, Pointers and Arrays (1) C has special memory model (inherited from BCPL and B) where the memory is seen as big array of bytes (in BCPL and B it was an array of machine words.) In this model an integer (unsigned) can be interpreted as an index in the memory array: it becomes a pointer. So one can access the pointed memory cell using the dereference operation. If p is a pointer, then *p returns the value in the corresponding memory cell. Since pointers are simply integer rather than abstraction over machine memory addresses (address mechanisms are sometimes a little bit more complex than just simple integer), arithmetic operations such as addition can be used over them. In this model, if p points to some memory cell, p+1 points to the next cell. Imperative And Structured Syntax

20 Memory Model, Pointers and Arrays (2) In B and BCPL, since the only type available was machine words, the pointers mechanism can serves as an array mechanism. To silently recover the B semantics, arithmetic over pointers has a type oriented semantics. In C, if p is pointer to some type t and value of this type need a storing size of size bytes, then the expression p+x (where x is any integer, signed or not) is interpreted as : p + size*x A simplified syntax for array accesses is provided, based on this semantics: p[i] is equivalent to *(p+i) Imperative And Structured Syntax

21 Separate Compilation C compilation schema allow for separate compilation units. To provide the finally binary, the linker assigns addresses to each symbol in different unit and then replaces symbol names with thoses addresses. The language itself doesn t provide any modules mechanism: as long as each used symbols is described somewhere in the source code, the first steps of compilation will work (it only requires to verify the existence of symbols, their sizes and eventually their structures.) This simple mechanism as some drawback, but offers a powerfull and yet simple way of dealing with separate unit. Imperative And Structured Syntax

22 Overview 2 Imperative And Structured Syntax Imperative And Structured Syntax

23 Global Code Structures All our code will be placed in functions. A functions body is a sequence of statements. There s no procedure, function return type can be void: the empty type. The return statement in function always escape the current context, even for void functions. The special function main is used as an entry point to the program. Functions can be recursive or mutuality recursive, the only constraint is that type of functions should be declared before their calls. Imperative And Structured Syntax

24 Expression Expression can be: A scalar value (integer, float... ): 42 Two expressions and a binary operator, or one expression with an unary operator: e1 + e2 or e++ A function call: f(e1,e2) A ternary operation: e1? e2 : e3 Field access: e.name or with pointer e->name An assignement (can be combine with an operation): x = e or x += e A type cast: (int)e A sequence of expressions: e1, e2 Every expression return a value even assignement and can have side-effect. Imperative And Structured Syntax

25 Statements Statements can be: An empty statement: ; An expression: e; A control flow structure: if/else, while, do/while or for loop A control flow special statement: return, break, continue and goto. A block (a sequence of statements) Variables declarations. While statements should not return any value in a pure imperative model, in C each statement leaves a value on the stack that sometimes can be used as return value. Imperative And Structured Syntax

26 Variables Declarations All variables declarations (global or local) follow the same structure. The syntax obey to the paradigm: declared as used. Some example: Declaring Variables // A simple int int x; // An array of 256 int int t[256]; // A pointer to char char *s; // A pointer to some struct struct my_struct *p; // A pointer to a function from int to float float(*fp)(int); Imperative And Structured Syntax

27 More Declarations More... // Several variables on the same line int x, y, z; // mixed with initialization int x, y = 0, z; //... pointers... int x, *y, z; Beware, for the last example, the star (*) is always attached to the variable, not the type, and thus, x is an integer, y a pointer to an integer and z an integer.... and even more... // string literal for init char *s = "a string literal"; Imperative And Structured Syntax

28 Assignements In C an assignement is an expression returning the assigned value. There s other possible assignements: operator-assignement (like +=) providing a short-hand for fetch and modify operations. The language also offers increment and decrement in two flavor: pre-increment: returns the value before the modification post-increment: returns the value after the modification As usual, all assignement operations can only be used on left-value operands (variables, array cells or dereferenced pointers... ) Imperative And Structured Syntax

29 Assignements Some Assignements int x, y, z; // Assign 42 to y, and then to x x = y = 42; // test an assigned value if ( (z = x+y) > 42 ) x = 41; // Now x==41, and we want to make it wright x += 1; // now x == 42! x -= 2; // and now 40 x /= 2, x *= 2; // more... y = ++x; // x = 41 and y = 41 z = x++; // x = 42 and z = 41 Imperative And Structured Syntax

30 Control Flow Structures: loops C provides two kind of loops: while and do/while loops. for loops are a variation of the while loop and not real bounded iterations loop (like in Pascal.) Syntax: while while ( cond ) statement Syntax: do/while do statement while ( cond ); Syntax: for for (expr; cond; expr) statement Imperative And Structured Syntax

31 Control Flow Structures: if C provides the usual if construction with optional else. The construction obey traditional rules. The so-called then statement and else statement are just statement (and then can be block) and one can use a terminating semi-colon unlike in Pascal. if ( cond ) statement Syntax: if Imperative And Structured Syntax if ( cond ) statement else statement Syntax: if-else

32 Control Flow Special return: the return statement exit the actual function and return the given value. break: exit the inner most loop (directly jump after the control flow statement.) continue: skip to the next loop iteration (directly jump at the begining of the control flow statement.) goto: jump to a specific label (a label is a marker you can simply add to any statement in the code.) Can traverse context, use with caution. Imperative And Structured Syntax

33 Compilers Using make Other

34 Overview 3 Compilers Using make Other Compilers Using make Other

35 Available Compilers There exists several compilers for various environment. The most known (and used) are: GNU Compiler Collection (gcc) Intel C Compiler clang (LLVM) BSD evolution of the original pcc SUN/Solaris C Compiler Microsoft C Compiler Borland/Inprise C Compiler Each compiler have various advantages and drawbacks. They also support more or less the standard (C89 for all of them, C99 at various state and C11 experimentaly.) Compilers Using make Other

36 Open Source Unix Compilers GNU Compiler Collection gcc: Probably the one that support the biggest number of architectures Originally based on pcc, it is now able to compile a wide variety of languages (C, C++, Java, Objective-C, Pascal, Fortran... ) A pretty good optimizing compiler. Error messages tend to be a little raw. Support C99, C++98 and a growing part of C++11 gcc is considered as one of the bloatest software. clang (LLVM): Have less (for now) architectures support. Better error messages Based on a generic back-end (LLVM) Better internal conception Support C99, C++98 and a growing part of C++11 Support also GNU-C extension (from gcc) Compilers Using make Other

37 Commercial Compilers Intel Compilers: Probably the best optimizing compiler for ia32, emt64 and ia64 Support for incomming standard is on the way. Implementation reference for all OpenMP (parallel extension to C) Microsoft Compilers: Compiler from the Visual Studio suite but also available as command line tools Have its own syntax extension Almost full support of C++11 for next release (expected) And for the other... Compilers Using make Other

38 Usage And Options We will focus on gcc and clang (preferred), they globally have the same option and syntax. Suppose you want to compile a single file program, the source code is in prg.c and we want to produce prg. Here are the the commands with the two compilers: > clang -o prg prg.c > gcc -o prg prg.c And now, the same with the usual options: > clang -Wall -Wextra -std=c99 -O2 -o prg prg.c > gcc -Wall -Wextra -std=c99 -O2 -o prg prg.c Compilers Using make Other

39 Usual Options -Wall: activate standard warnings -Wextra: add extra warnings -std=c99: use the ISO C99 standard, can be replaced with various variant like c89, gnu89 (c89 + GNU extensions), gnu99 (c99 + GNU extensions)... -O2: use optimization level 2 (triggers even more warnings.) Optimization levels range from -O0 (no optimization at all) to -O3 (a lot of optimizations are activated.) -g: produce information for the debugger (should not be used in conjunction with -ON with N>0) -o name: produce file name -c: do not link produced code, only output object file (file.o) Compilers Using make Other

40 Multiple Files Project When splitting your code in multiple files, you need some header files providing symbol signatures for other files. Suppose we have the following source code files: data.c, algo.c and main.c We should provide the following headers: data.h and algo.h. To compile the project we should first produce object files: data.o and algo.o We can then produce the executable (prg for example) by providing object files when compiling main.c. Compilers Using make Other clang -Wall -Wextra -std=c99 -O2 -c data.c clang -Wall -Wextra -std=c99 -O2 -c algo.c clang -Wall -Wextra -std=c99 -O2 -o prg data.o algo.o main.c

41 Overview 3 Compilers Using make Other Compilers Using make Other

42 Predefined Rules make already knows how to produce object files out of C files, it knows also how to produce an executable out of a single source files. Let us try! hello.c #include <stdio.h> int main() { printf("hello, World!\n"); return 0; } Compilers Using make Other > make hello cc hello.c -o hello > make hello.o cc -c -o hello.o hello.c

43 Controlling Predefined Rules make uses several environment variables to control which compiler to use and which options should it be given. > rm -f hello hello.o > setenv CC clang > setenv CFLAGS "-Wall -Wextra -std=c99 -O2" > make hello clang -Wall -Wextra -std=c99 -O2 hello.c -o hello > make hello.o clang -Wall -Wextra -std=c99 -O2 -c -o hello.o hello.c Compilers Using make Other

44 An Example Of A Makefile Makefile # A Simple Makefile Example CC=clang CFLAGS= -Wall -Wextra -std=c99 -O2 LDFLAGS= SRC= data.c algo.c OBJ= ${SRC:.c=.o} Compilers Using make Other main: ${OBJ} clean:: rm -f *~ *.o main # END

45 Overview 3 Compilers Using make Other Compilers Using make Other

46 More? Unix traditionally provides a lot of developers tools. You ll probably use the gdb debugger. You can reformat your code using indent. You can analyse it in order to find performance bottlenecks using gprof You can verify your memory usage with valgrind. Compilers Using make Other

47 Simple Mathematical Functions Vectors

48 Overview 4 Simple Mathematical Functions Vectors Simple Mathematical Functions Vectors

49 Factorial Recursive Factorial // size_t: unsigned integer word sized size_t fact(size_t n) { return n > 1? n * fact(n-1) : 1; } Iterative Factorial size_t fact_iter(size_t n) { size_t res=1; for (; n; --n) res *= n; return res; } Simple Mathematical Functions Vectors

50 Fibonacci Recursive Fibonacci size_t fibo(size_t n) { return n > 1? fibo(n-1) + fibo(n-2) : n; } Iterative Fibonacci size_t fibo_iter(size_t n) { size_t curr=1, prev=0, tmp; for (size_t i=1; i < n; ++i) { tmp = curr; curr += prev; prev = tmp; } return n > 1? curr : n; } Simple Mathematical Functions Vectors

51 Quick Power Recursive Quick Power size_t qpower(size_t a, size_t b) { if (!b ) return 1; return (b % 2? a : 1) * qpower(a*a, b >> 1); } Iterative Quick Power size_t qpower_iter(size_t a, size_t b) { if (!b ) return 1; size_t accu; for (accu = 1; b > 1; b >>= 1) { accu *= b % 2? a : 1; a *= a; } return accu * a; } Simple Mathematical Functions Vectors

52 Overview 4 Simple Mathematical Functions Vectors Simple Mathematical Functions Vectors

53 Vectors: Headers The following example is a toy example demonstrating the splitting of a program in several files. data.h /* A simple vector structure: header */ #ifndef EXAMPLE_DATA_H_ #define EXAMPLE_DATA_H_ typedef struct s_vect *vector; struct s_vect { size_t size; int tab[256]; }; void vector_init(vector v); void vector_add(vector v, int x); #endif Simple Mathematical Functions Vectors

54 Vectors: Basic Operations data.c /* A simple vector structure */ #include <stdlib.h> #include "data.h" void vector_init(vector v) { v->size = 0; } Simple Mathematical Functions Vectors void vector_add(vector v, int x) { if (v->size < 256) v->tab[v->size++] = x; }

55 Vectors: An Algo algo.h #ifndef EXAMPLE_ALGO_H_ #define EXAMPLE_ALGO_H_ int find(vector v, int x); #endif /* A simple algo */ #include <stdlib.h> #include "data.h" #include "algo.h" algo.c Simple Mathematical Functions Vectors int find(vector v, int x) { size_t i=0; for (; i < v->size && v->tab[i]!= x; ++i); return (i < v->size && v->tab[i] == x); }

56 And The Main Program main.c #define _XOPEN_SOURCE 500 #include <stdlib.h> #include <stdio.h> #include "data.h" #include "algo.h" int main(int argc, char *argv[]) { int seed=42, target; size_t size=64; struct s_vect inner_vect; vector v = &inner_vect; if (argc > 1) seed = atoi(argv[1]); if (argc > 2) size = atoi(argv[2]); srandom(seed); Simple Mathematical Functions Vectors

57 And The Main Program main.c if (argc > 3) target = atoi(argv[3]); else target = random() % size; vector_init(v); for (size_t i=0; i<size; ++i) vector_add(v, random() % size); printf("looking for %d in v: %s\n", target, find(v,target)?"yes":"no"); Simple Mathematical Functions Vectors return 0; }

58

59 Kernighan and Ritchie.. Prentice Hall, Englewood Cliffs, D. Ritchie. The development of the C language. In Second History of s Conference, April 1993.

Writing an ANSI C Program Getting Ready to Program A First Program Variables, Expressions, and Assignments Initialization The Use of #define and

Writing an ANSI C Program Getting Ready to Program A First Program Variables, Expressions, and Assignments Initialization The Use of #define and Writing an ANSI C Program Getting Ready to Program A First Program Variables, Expressions, and Assignments Initialization The Use of #define and #include The Use of printf() and scanf() The Use of printf()

More information

Programming in C. What is C?... What is C?

Programming in C. What is C?... What is C? C Programming in C UVic SEng 265 Developed by Brian Kernighan and Dennis Ritchie of Bell Labs Earlier, in 1969, Ritchie and Thompson developed the Unix operating system We will be focusing on a version

More information

Programming in C UVic SEng 265

Programming in C UVic SEng 265 Programming in C UVic SEng 265 Daniel M. German Department of Computer Science University of Victoria 1 SEng 265 dmgerman@uvic.ca C Developed by Brian Kernighan and Dennis Ritchie of Bell Labs Earlier,

More information

Language Design COMS W4115. Prof. Stephen A. Edwards Spring 2003 Columbia University Department of Computer Science

Language Design COMS W4115. Prof. Stephen A. Edwards Spring 2003 Columbia University Department of Computer Science Language Design COMS W4115 Prof. Stephen A. Edwards Spring 2003 Columbia University Department of Computer Science Language Design Issues Syntax: how programs look Names and reserved words Instruction

More information

Programming in C. What is C?... What is C?

Programming in C. What is C?... What is C? Programming in C UVic SEng 265 C Developed by Brian Kernighan and Dennis Ritchie of Bell Labs Earlier, in 1969, Ritchie and Thompson developed the Unix operating system We will be focusing on a version

More information

Topic 6: A Quick Intro To C. Reading. "goto Considered Harmful" History

Topic 6: A Quick Intro To C. Reading. goto Considered Harmful History Topic 6: A Quick Intro To C Reading Assumption: All of you know basic Java. Much of C syntax is the same. Also: Some of you have used C or C++. Goal for this topic: you can write & run a simple C program

More information

CS201 - Lecture 1 The C Programming Language

CS201 - Lecture 1 The C Programming Language CS201 - Lecture 1 The C Programming Language RAOUL RIVAS PORTLAND STATE UNIVERSITY History of the C Language The C language was invented in 1970 by Dennis Ritchie Dennis Ritchie and Ken Thompson were employees

More information

Topic 6: A Quick Intro To C

Topic 6: A Quick Intro To C Topic 6: A Quick Intro To C Assumption: All of you know Java. Much of C syntax is the same. Also: Many of you have used C or C++. Goal for this topic: you can write & run a simple C program basic functions

More information

CS Basics 15) Compiling a C prog.

CS Basics 15) Compiling a C prog. CS Basics 15) Compiling a C prog. Emmanuel Benoist Fall Term 2016-17 Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 1 Compiling a C program Example of a small

More information

Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 2

Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 2 Compiling a C program CS Basics 15) Compiling a C prog. Emmanuel Benoist Fall Term 2016-17 Example of a small program Makefile Define Variables Compilation options Conclusion Berner Fachhochschule Haute

More information

CSCI 171 Chapter Outlines

CSCI 171 Chapter Outlines Contents CSCI 171 Chapter 1 Overview... 2 CSCI 171 Chapter 2 Programming Components... 3 CSCI 171 Chapter 3 (Sections 1 4) Selection Structures... 5 CSCI 171 Chapter 3 (Sections 5 & 6) Iteration Structures

More information

Language Design COMS W4115. Prof. Stephen A. Edwards Fall 2006 Columbia University Department of Computer Science

Language Design COMS W4115. Prof. Stephen A. Edwards Fall 2006 Columbia University Department of Computer Science Language Design COMS W4115 Katsushika Hokusai, In the Hollow of a Wave off the Coast at Kanagawa, 1827 Prof. Stephen A. Edwards Fall 2006 Columbia University Department of Computer Science Language Design

More information

Deep C. Multifile projects Getting it running Data types Typecasting Memory management Pointers. CS-343 Operating Systems

Deep C. Multifile projects Getting it running Data types Typecasting Memory management Pointers. CS-343 Operating Systems Deep C Multifile projects Getting it running Data types Typecasting Memory management Pointers Fabián E. Bustamante, Fall 2004 Multifile Projects Give your project a structure Modularized design Reuse

More information

Binghamton University. CS-120 Summer Introduction to C. Text: Introduction to Computer Systems : Chapters 11, 12, 14, 13

Binghamton University. CS-120 Summer Introduction to C. Text: Introduction to Computer Systems : Chapters 11, 12, 14, 13 Introduction to C Text: Introduction to Computer Systems : Chapters 11, 12, 14, 13 Problem: Too Many Details For example: Lab 7 Bubble Sort Needed to keep track of too many details! Outer Loop When do

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

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

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

Room 3P16 Telephone: extension ~irjohnson/uqc146s1.html

Room 3P16 Telephone: extension ~irjohnson/uqc146s1.html UQC146S1 Introductory Image Processing in C Ian Johnson Room 3P16 Telephone: extension 3167 Email: Ian.Johnson@uwe.ac.uk http://www.csm.uwe.ac.uk/ ~irjohnson/uqc146s1.html Ian Johnson 1 UQC146S1 What is

More information

ELEC 377 C Programming Tutorial. ELEC Operating Systems

ELEC 377 C Programming Tutorial. ELEC Operating Systems ELE 377 Programming Tutorial Outline! Short Introduction! History & Memory Model of! ommon Errors I have seen over the years! Work through a linked list example on the board! - uses everything I talk about

More information

The component base of C language. Nguyễn Dũng Faculty of IT Hue College of Science

The component base of C language. Nguyễn Dũng Faculty of IT Hue College of Science The component base of C language Nguyễn Dũng Faculty of IT Hue College of Science Content A brief history of C Standard of C Characteristics of C The C compilation model Character set and keyword Data

More information

PRINCIPLES OF OPERATING SYSTEMS

PRINCIPLES OF OPERATING SYSTEMS PRINCIPLES OF OPERATING SYSTEMS Tutorial-1&2: C Review CPSC 457, Spring 2015 May 20-21, 2015 Department of Computer Science, University of Calgary Connecting to your VM Open a terminal (in your linux machine)

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

Holtek C and ANSI C Feature Comparison User s Guide

Holtek C and ANSI C Feature Comparison User s Guide Holtek C and ANSI C Feature Comparison User s Guide July 2009 Copyright 2009 by HOLTEK SEMICONDUCTOR INC. All rights reserved. Printed in Taiwan. No part of this publication may be reproduced, stored in

More information

CSCI-243 Exam 1 Review February 22, 2015 Presented by the RIT Computer Science Community

CSCI-243 Exam 1 Review February 22, 2015 Presented by the RIT Computer Science Community CSCI-243 Exam 1 Review February 22, 2015 Presented by the RIT Computer Science Community http://csc.cs.rit.edu History and Evolution of Programming Languages 1. Explain the relationship between machine

More information

Tutorial 1: Introduction to C Computer Architecture and Systems Programming ( )

Tutorial 1: Introduction to C Computer Architecture and Systems Programming ( ) Systems Group Department of Computer Science ETH Zürich Tutorial 1: Introduction to C Computer Architecture and Systems Programming (252-0061-00) Herbstsemester 2012 Goal Quick introduction to C Enough

More information

High-performance computing and programming I. Introduction to C programming in *NIX

High-performance computing and programming I. Introduction to C programming in *NIX High-performance computing and programming I Introduction to C programming in *NIX Writing C programs in Unix/Linux Writing code Building code compile with gcc (or cc) link with gcc (or ld) make Environment

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

The C Language Reference Manual

The C Language Reference Manual The C Language Reference Manual Stephen A. Edwards Columbia University Summer 2014 Katsushika Hokusai, In the Hollow of a Wave off the Coast at Kanagawa, 1827 Part I The History of C C History Developed

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

C Compilation Model. Comp-206 : Introduction to Software Systems Lecture 9. Alexandre Denault Computer Science McGill University Fall 2006

C Compilation Model. Comp-206 : Introduction to Software Systems Lecture 9. Alexandre Denault Computer Science McGill University Fall 2006 C Compilation Model Comp-206 : Introduction to Software Systems Lecture 9 Alexandre Denault Computer Science McGill University Fall 2006 Midterm Date: Thursday, October 19th, 2006 Time: from 16h00 to 17h30

More information

Motivation was to facilitate development of systems software, especially OS development.

Motivation was to facilitate development of systems software, especially OS development. A History Lesson C Basics 1 Development of language by Dennis Ritchie at Bell Labs culminated in the C language in 1972. Motivation was to facilitate development of systems software, especially OS development.

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

Two s Complement Review. Two s Complement Review. Agenda. Agenda 6/21/2011

Two s Complement Review. Two s Complement Review. Agenda. Agenda 6/21/2011 Two s Complement Review CS 61C: Great Ideas in Computer Architecture (Machine Structures) Introduction to C (Part I) Instructor: Michael Greenbaum http://inst.eecs.berkeley.edu/~cs61c/su11 Suppose we had

More information

CS Programming In C

CS Programming In C CS 24000 - Programming In C Week Two: Basic C Program Organization and Data Types Zhiyuan Li Department of Computer Science Purdue University, USA 2 int main() { } return 0; The Simplest C Program C programs

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

C Programming Language Training. This instruction relies on the C language described in C++: The Complete Reference Third Edition By Herbert Schildt

C Programming Language Training. This instruction relies on the C language described in C++: The Complete Reference Third Edition By Herbert Schildt C Programming Language Training This instruction relies on the C language described in C++: The Complete Reference Third Edition By Herbert Schildt Background The C language was developed at Bell Labs

More information

Introduction to C Language

Introduction to C Language Introduction to C Language Instructor: Professor I. Charles Ume ME 6405 Introduction to Mechatronics Fall 2006 Instructor: Professor Charles Ume Introduction to C Language History of C Language In 1972,

More information

Introduction to C Programming

Introduction to C Programming Introduction to C Programming Digital Design and Computer Architecture David Money Harris and Sarah L. Harris 2- C Chapter :: Topics Introduction to C Why C? Example Program Compiling and running a

More information

C Review. MaxMSP Developers Workshop Summer 2009 CNMAT

C Review. MaxMSP Developers Workshop Summer 2009 CNMAT C Review MaxMSP Developers Workshop Summer 2009 CNMAT C Syntax Program control (loops, branches): Function calls Math: +, -, *, /, ++, -- Variables, types, structures, assignment Pointers and memory (***

More information

Motivation was to facilitate development of systems software, especially OS development.

Motivation was to facilitate development of systems software, especially OS development. A History Lesson C Basics 1 Development of language by Dennis Ritchie at Bell Labs culminated in the C language in 1972. Motivation was to facilitate development of systems software, especially OS development.

More information

Course organization. Part I: Introduction to C programming language (Week 1-12) Chapter 1: Overall Introduction (Week 1-4)

Course organization. Part I: Introduction to C programming language (Week 1-12) Chapter 1: Overall Introduction (Week 1-4) Course organization 1 Course introduction ( Week 1) Code editor: Emacs Part I: Introduction to C programming language (Week 1-12) Chapter 1: Overall Introduction (Week 1-4) C Unix/Linux Chapter 2: Types,

More information

IECD Institute for Entrepreneurship and Career Development Bharathidasan University, Tiruchirappalli 23.

IECD Institute for Entrepreneurship and Career Development Bharathidasan University, Tiruchirappalli 23. Subject code - CCP01 Chapt Chapter 1 INTRODUCTION TO C 1. A group of software developed for certain purpose are referred as ---- a. Program b. Variable c. Software d. Data 2. Software is classified into

More information

Programming Fundamentals (CS 302 ) Dr. Ihsan Ullah. Lecturer Department of Computer Science & IT University of Balochistan

Programming Fundamentals (CS 302 ) Dr. Ihsan Ullah. Lecturer Department of Computer Science & IT University of Balochistan Programming Fundamentals (CS 302 ) Dr. Ihsan Ullah Lecturer Department of Computer Science & IT University of Balochistan 1 Outline p Introduction p Program development p C language and beginning with

More information

6.096 Introduction to C++ January (IAP) 2009

6.096 Introduction to C++ January (IAP) 2009 MIT OpenCourseWare http://ocw.mit.edu 6.096 Introduction to C++ January (IAP) 2009 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms. Welcome to 6.096 Lecture

More information

Programs. Function main. C Refresher. CSCI 4061 Introduction to Operating Systems

Programs. Function main. C Refresher. CSCI 4061 Introduction to Operating Systems Programs CSCI 4061 Introduction to Operating Systems C Program Structure Libraries and header files Compiling and building programs Executing and debugging Instructor: Abhishek Chandra Assume familiarity

More information

Computers Programming Course 5. Iulian Năstac

Computers Programming Course 5. Iulian Năstac Computers Programming Course 5 Iulian Năstac Recap from previous course Classification of the programming languages High level (Ada, Pascal, Fortran, etc.) programming languages with strong abstraction

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

C LANGUAGE AND ITS DIFFERENT TYPES OF FUNCTIONS

C LANGUAGE AND ITS DIFFERENT TYPES OF FUNCTIONS C LANGUAGE AND ITS DIFFERENT TYPES OF FUNCTIONS Manish Dronacharya College Of Engineering, Maharishi Dayanand University, Gurgaon, Haryana, India III. Abstract- C Language History: The C programming language

More information

Software Project. Lecturers: Ran Caneti, Gideon Dror Teaching assistants: Nathan Manor, Ben Riva

Software Project. Lecturers: Ran Caneti, Gideon Dror Teaching assistants: Nathan Manor, Ben Riva Software Project Lecturers: Ran Caneti, Gideon Dror Teaching assistants: Nathan Manor, Ben Riva Emails: (canetti/benriva)@post.tau.ac.il nathan.manor@gmail.com gideon@mta.ac.il http://www.cs.tau.ac.il/~roded/courses/soft-project10.html

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

C Language Part 1 Digital Computer Concept and Practice Copyright 2012 by Jaejin Lee

C Language Part 1 Digital Computer Concept and Practice Copyright 2012 by Jaejin Lee C Language Part 1 (Minor modifications by the instructor) References C for Python Programmers, by Carl Burch, 2011. http://www.toves.org/books/cpy/ The C Programming Language. 2nd ed., Kernighan, Brian,

More information

Variables and literals

Variables and literals Demo lecture slides Although I will not usually give slides for demo lectures, the first two demo lectures involve practice with things which you should really know from G51PRG Since I covered much of

More information

Programming in C - Part 2

Programming in C - Part 2 Programming in C - Part 2 CPSC 457 Mohammad Reza Zakerinasab May 11, 2016 These slides are forked from slides created by Mike Clark Where to find these slides and related source code? http://goo.gl/k1qixb

More information

Ricardo Rocha. Department of Computer Science Faculty of Sciences University of Porto

Ricardo Rocha. Department of Computer Science Faculty of Sciences University of Porto Ricardo Rocha Department of Computer Science Faculty of Sciences University of Porto Adapted from the slides Revisões sobre Programação em C, Sérgio Crisóstomo Compilation #include int main()

More information

Introduction to C Programming (Part A) Copyright 2008 W. W. Norton & Company. All rights Reserved

Introduction to C Programming (Part A) Copyright 2008 W. W. Norton & Company. All rights Reserved Introduction to C Programming (Part A) Copyright 2008 W. W. Norton & Company. All rights Reserved Overview (King Ch. 1-7) Introducing C (Ch. 1) C Fundamentals (Ch. 2) Formatted Input/Output (Ch. 3) Expressions

More information

Kurt Schmidt. October 30, 2018

Kurt Schmidt. October 30, 2018 to Structs Dept. of Computer Science, Drexel University October 30, 2018 Array Objectives to Structs Intended audience: Student who has working knowledge of Python To gain some experience with a statically-typed

More information

Programming in C Quick Start! Biostatistics 615 Lecture 4

Programming in C Quick Start! Biostatistics 615 Lecture 4 Programming in C Quick Start! Biostatistics 615 Lecture 4 Last Lecture Analysis of Algorithms Empirical Analysis Mathematical Analysis Big-Oh notation Today Basics of programming in C Syntax of C programs

More information

Week 1 / Lecture 2 8 March 2017 NWEN 241 C Fundamentals. Alvin Valera. School of Engineering and Computer Science Victoria University of Wellington

Week 1 / Lecture 2 8 March 2017 NWEN 241 C Fundamentals. Alvin Valera. School of Engineering and Computer Science Victoria University of Wellington Week 1 / Lecture 2 8 March 2017 NWEN 241 C Fundamentals Alvin Valera School of Engineering and Computer Science Victoria University of Wellington Admin stuff People Course Coordinator Lecturer Alvin Valera

More information

COMP 2355 Introduction to Systems Programming

COMP 2355 Introduction to Systems Programming COMP 2355 Introduction to Systems Programming Christian Grothoff christian@grothoff.org http://grothoff.org/christian/ 1 Functions Similar to (static) methods in Java without the class: int f(int a, int

More information

Dr M Kasim A Jalil. Faculty of Mechanical Engineering UTM (source: Deitel Associates & Pearson)

Dr M Kasim A Jalil. Faculty of Mechanical Engineering UTM (source: Deitel Associates & Pearson) Lecture 9 Functions Dr M Kasim A Jalil Faculty of Mechanical Engineering UTM (source: Deitel Associates & Pearson) Objectives In this chapter, you will learn: To understand how to construct programs modularly

More information

The C language. Introductory course #1

The C language. Introductory course #1 The C language Introductory course #1 History of C Born at AT&T Bell Laboratory of USA in 1972. Written by Dennis Ritchie C language was created for designing the UNIX operating system Quickly adopted

More information

Signals, Instruments, and Systems W2. C Programming (continued)

Signals, Instruments, and Systems W2. C Programming (continued) Signals, Instruments, and Systems W2 C Programming (continued) 1 Resources 2 Remember man? You can use man to show information about functions in the standard libraries of C: e.g. man printf or man atan2

More information

#include <stdio.h> int main() { printf ("hello class\n"); return 0; }

#include <stdio.h> int main() { printf (hello class\n); return 0; } C #include int main() printf ("hello class\n"); return 0; Working environment Linux, gcc We ll work with c9.io website, which works with ubuntu I recommend to install ubuntu too Also in tirgul

More information

A Fast Review of C Essentials Part I

A Fast Review of C Essentials Part I A Fast Review of C Essentials Part I Structural Programming by Z. Cihan TAYSI Outline Program development C Essentials Functions Variables & constants Names Formatting Comments Preprocessor Data types

More information

gcc hello.c a.out Hello, world gcc -o hello hello.c hello Hello, world

gcc hello.c a.out Hello, world gcc -o hello hello.c hello Hello, world alun@debian:~$ gcc hello.c alun@debian:~$ a.out Hello, world alun@debian:~$ gcc -o hello hello.c alun@debian:~$ hello Hello, world alun@debian:~$ 1 A Quick guide to C for Networks and Operating Systems

More information

Computer Science 2500 Computer Organization Rensselaer Polytechnic Institute Spring Topic Notes: C and Unix Overview

Computer Science 2500 Computer Organization Rensselaer Polytechnic Institute Spring Topic Notes: C and Unix Overview Computer Science 2500 Computer Organization Rensselaer Polytechnic Institute Spring 2009 Topic Notes: C and Unix Overview This course is about computer organization, but since most of our programming is

More information

Introduction to Computing Lecture 01: Introduction to C

Introduction to Computing Lecture 01: Introduction to C Introduction to Computing Lecture 01: Introduction to C Assist.Prof.Dr. Nükhet ÖZBEK Ege University Department of Electrical&Electronics Engineering ozbek.nukhet@gmail.com Topics Introduction to C language

More information

CSE 333 Midterm Exam 7/29/13

CSE 333 Midterm Exam 7/29/13 Name There are 5 questions worth a total of 100 points. Please budget your time so you get to all of the questions. Keep your answers brief and to the point. The exam is closed book, closed notes, closed

More information

CSCI-243 Exam 2 Review February 22, 2015 Presented by the RIT Computer Science Community

CSCI-243 Exam 2 Review February 22, 2015 Presented by the RIT Computer Science Community CSCI-43 Exam Review February, 01 Presented by the RIT Computer Science Community http://csc.cs.rit.edu C Preprocessor 1. Consider the following program: 1 # include 3 # ifdef WINDOWS 4 # include

More information

Introduction to C. Robert Escriva. Cornell CS 4411, August 30, Geared toward programmers

Introduction to C. Robert Escriva. Cornell CS 4411, August 30, Geared toward programmers Introduction to C Geared toward programmers Robert Escriva Slide heritage: Alin Dobra Niranjan Nagarajan Owen Arden Cornell CS 4411, August 30, 2010 1 Why C? 2 A Quick Example 3 Programmer s Responsibilities

More information

Princeton University COS 333: Advanced Programming Techniques A Subset of C90

Princeton University COS 333: Advanced Programming Techniques A Subset of C90 Princeton University COS 333: Advanced Programming Techniques A Subset of C90 Program Structure /* Print "hello, world" to stdout. Return 0. */ { printf("hello, world\n"); -----------------------------------------------------------------------------------

More information

CMSC 246 Systems Programming

CMSC 246 Systems Programming CMSC 246 Systems Programming Spring 2018 Bryn Mawr College Instructor: Deepak Kumar CMSC 246 Systems Programming 1 Go to class web page 3 Goals Learn Linux (CLI, not WIMP!) Learn C Learn Linux tools 4

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

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

Programming in C First meeting

Programming in C First meeting Programming in C First meeting 8.9.2016 Tiina Niklander Faculty of Science Department of Computer Science www.cs.helsinki.fi 8.9.2016 1 Course structure Weekly exercise deadline on Wednesday, lectures

More information

Maemo Diablo GNU Make and makefiles Training Material

Maemo Diablo GNU Make and makefiles Training Material Maemo Diablo GNU Make and makefiles Training Material February 9, 2009 Contents 1 GNU Make and makefiles 2 1.1 What is GNU Make?......................... 2 1.2 How does make work?........................

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

are all acceptable. With the right compiler flags, Java/C++ style comments are also acceptable.

are all acceptable. With the right compiler flags, Java/C++ style comments are also acceptable. CMPS 12M Introduction to Data Structures Lab Lab Assignment 3 The purpose of this lab assignment is to introduce the C programming language, including standard input-output functions, command line arguments,

More information

Functions. Angela Chih-Wei Tang ( 唐之瑋 ) Department of Communication Engineering National Central University JhongLi, Taiwan.

Functions. Angela Chih-Wei Tang ( 唐之瑋 ) Department of Communication Engineering National Central University JhongLi, Taiwan. Functions Angela Chih-Wei Tang ( 唐之瑋 ) Department of Communication Engineering National Central University JhongLi, Taiwan 2009 Fall Outline 5.1 Introduction 5.3 Math Library Functions 5.4 Functions 5.5

More information

TDDB68 Concurrent Programming and Operating Systems. Lecture 2: Introduction to C programming

TDDB68 Concurrent Programming and Operating Systems. Lecture 2: Introduction to C programming TDDB68 Concurrent Programming and Operating Systems Lecture 2: Introduction to C programming Mikael Asplund, Senior Lecturer Real-time Systems Laboratory Department of Computer and Information Science

More information

Computers in Engineering. Moving From Fortran to C Michael A. Hawker

Computers in Engineering. Moving From Fortran to C Michael A. Hawker Computers in Engineering COMP 208 Moving From Fortran to C Michael A. Hawker Remember our first Fortran program? PROGRAM hello IMPLICIT NONE!This is my first program WRITE (*,*) "Hello, World!" END PROGRAM

More information

Features of C. Portable Procedural / Modular Structured Language Statically typed Middle level language

Features of C. Portable Procedural / Modular Structured Language Statically typed Middle level language 1 History C is a general-purpose, high-level language that was originally developed by Dennis M. Ritchie to develop the UNIX operating system at Bell Labs. C was originally first implemented on the DEC

More information

High Performance Programming Programming in C part 1

High Performance Programming Programming in C part 1 High Performance Programming Programming in C part 1 Anastasia Kruchinina Uppsala University, Sweden April 18, 2017 HPP 1 / 53 C is designed on a way to provide a full control of the computer. C is the

More information

CAAM 420 Fall 2012 Lecture 15. Roman Schutski

CAAM 420 Fall 2012 Lecture 15. Roman Schutski CAAM 420 Fall 2012 Lecture 15 Roman Schutski December 2, 2012 Table of Contents 1 Using make. Structures. 3 1.1 Makefiles...................................... 3 1.1.1 Syntax...................................

More information

Short Notes of CS201

Short Notes of CS201 #includes: Short Notes of CS201 The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with < and > if the file is a system

More information

C: Pointers, Arrays, and strings. Department of Computer Science College of Engineering Boise State University. August 25, /36

C: Pointers, Arrays, and strings. Department of Computer Science College of Engineering Boise State University. August 25, /36 Department of Computer Science College of Engineering Boise State University August 25, 2017 1/36 Pointers and Arrays A pointer is a variable that stores the address of another variable. Pointers are similar

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

Programming and Data Structure

Programming and Data Structure Programming and Data Structure Sujoy Ghose Sudeshna Sarkar Jayanta Mukhopadhyay Dept. of Computer Science & Engineering. Indian Institute of Technology Kharagpur Spring Semester 2012 Programming and Data

More information

LECTURE 18. Control Flow

LECTURE 18. Control Flow LECTURE 18 Control Flow CONTROL FLOW Sequencing: the execution of statements and evaluation of expressions is usually in the order in which they appear in a program text. Selection (or alternation): a

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

CS201 - Introduction to Programming Glossary By

CS201 - Introduction to Programming Glossary By CS201 - Introduction to Programming Glossary By #include : The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with

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

Compiling and Running a C Program in Unix

Compiling and Running a C Program in Unix CPSC 211 Data Structures & Implementations (c) Texas A&M University [ 95 ] Compiling and Running a C Program in Unix Simple scenario in which your program is in a single file: Suppose you want to name

More information

Basic C Programming. Bin Li Assistant Professor Dept. of Electrical, Computer and Biomedical Engineering University of Rhode Island

Basic C Programming. Bin Li Assistant Professor Dept. of Electrical, Computer and Biomedical Engineering University of Rhode Island Basic C Programming Bin Li Assistant Professor Dept. of Electrical, Computer and Biomedical Engineering University of Rhode Island Announcements Exam 1 (20%): Feb. 27 (Tuesday) Tentative Proposal Deadline:

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

ECE 2400 Computer Systems Programming Fall 2017 Topic 12: Transition from C to C++

ECE 2400 Computer Systems Programming Fall 2017 Topic 12: Transition from C to C++ ECE 2400 Computer Systems Programming Fall 2017 Topic 12: Transition from C to C++ School of Electrical and Computer Engineering Cornell University revision: 2017-10-23-01-13 1 C++ Namespaces 2 2 C++ Functions

More information

C Language, Token, Keywords, Constant, variable

C Language, Token, Keywords, Constant, variable C Language, Token, Keywords, Constant, variable A language written by Brian Kernighan and Dennis Ritchie. This was to be the language that UNIX was written in to become the first "portable" language. C

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

introduction week 1 Ritsumeikan University College of Information Science and Engineering Ian Piumarta 1 / 20 imperative programming about the course

introduction week 1 Ritsumeikan University College of Information Science and Engineering Ian Piumarta 1 / 20 imperative programming about the course week 1 introduction Ritsumeikan University College of Information Science and Engineering Ian Piumarta 1 / 20 class format 30 minutes (give or take a few) presentation 60 minutes (give or take a few) practice

More information

Main differences with Java

Main differences with Java Signals, Instruments, and Systems W2 C Programming (continued) C Main differences with Java C is NOT object oriented. (C++ is OO) C code is directly translated into binary that can be directly executed

More information