The C Programming Language Guide for the Robot Course work Module

Size: px
Start display at page:

Download "The C Programming Language Guide for the Robot Course work Module"

Transcription

1 The C Programming Language Guide for the Robot Course work Module Eric Peasley 2018 v6.4 1

2 2

3 Table of Contents Variables...5 Assignments...6 Entering Numbers...6 Operators...7 Arithmetic Operators...7 Bitwise Logic Operators...8 Relational Logic operators...9 Assignment Operators...10 Type Conversion...11 Comments...11 Functions...12 void...12 The Main Function...13 Pre-Declaration...13 Global and Local Variables...14 External Variables...14 Flow Control...15 For Loop...15 While Loop...16 Do While Loops...16 If statement...17 Switch statement...18 Pointers...19 Type conversion to a pointer...19 Pass by Reference...20 Arrays...21 Passing Arrays to a Function...22 Arrays and Pointer Arithmetic...23 Structures...24 Pointers to Structures...25 Compilers Linkers and Make...26 Header files...27 Definitions and Macros...29 Program Structure and Layout...30 This guide is for the Robot Course Work Module. It does not contain a complete description of the C programming language. It only contains the syntax that is used in the Course Work Module. 3

4 4

5 Variables In C, a variable must be declared before it can be used. For example int a; unsigned long b; int and unsigned long are the types of the variables. This defines the size and the range of the variable. For the particular compiler we are using, the types are as follows. Type Size in bits Variable Types Range char 8 0 to 255 signed char to 127 unsigned char 8 0 to 255 short (signed) to unsigned short 16 0 to int (signed) to unsigned int 32 0 to long (signed) to unsigned long 32 0 to long long (signed) 64 9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 unsigned long long 64 0 to 18,446,744,073,709,551,615 float e-38 to e+38 double 64 init8_t to 127 uinit8_t 8 0 to e-308 to e+308 init16_t to uinit16_t 16 0 to init32_t to uinit32_t 32 0 to init64_t 64 9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 uinit64_t 64 0 to 18,446,744,073,709,551,615 5

6 The type char was originally intended to hold a character, but it can also be used hold an eight bit integer. If you wish, you can declare several variables at once. The following declares x, y and z to be of type int. int x, y, z; You can also set the initial value of a variable. Here the initial value of c is set to zero. unsigned char c = 0; Assignments Examples a = 42; b = 24 + a ; Each line is terminated with a semicolon. In C, the semicolon indicates the end of a statement. Entering Numbers The following are all ways of enter the same number, but using different number systems. Decimal (Base 10) c = 198; Binary (Base 2) c = 0b ; Hexadecimal (Base 16) c = 0xC6; You can also force a number to be of a particular kind. U or u after the number says treat as unsigned. c = 198U; L or l after a number says treat as a long c = 198L; Treat as an unsigned long. c = 198UL; 6

7 Operators Arithmetic Operators + Add - Subtract * Multiply / Divide % Remainder << Left Shift >> Right Shift Note : In this course the variables we use are all integers. Therefore, the results of division is truncated to a whole number. Example int a; int b; a = 5; b = (a + 6)*3; Left Shift Operator c = 0xD3; a = c << 3; Shift every binary digit to the left by n. This is equivalent to multiplying by 2 n. Right Shift Operator c = 0xD3; a = c >> 5; Shift every binary digit to the right by n. This is is equivalent to dividing by 2 n. 7

8 Bitwise Logic Operators ~ Bitwise NOT, every bit inverted. & Bitwise AND Bitwise OR ^ Exclusive OR These operations operate on each bit Examples of bitwise logic on unsigned chars a = 0b1011; b = ~a; Every bit in b set to the inverse of the corresponding bit in a. c = 0x0f; d = b & c; Each bit in d is the result of ANDing the corresponding bits in b and c. 8

9 Relational Logic operators > Greater than! NOT < Less than && AND >= Greater than or equal OR <= Less than or equal = = Is equal to! = Is not equal to These are used for comparing numbers in IF statements and WHILE loops. The results are either one for true or zero for false. Examples if ( left == 0 && right == 0 ) etc The condition is true if left AND right are both equal to zero. while ( a > 0) a--; Count down to zero. 9

10 Assignment Operators The increment operator a++ ; ++a ; is equivalent to a = a + 1; The position of the double plus sign determines when the variable is incremented. A double plus after the variable will increment after the rest of the expression has been executed. For example y = 5 * a++ ; is equivalent to y = 5 * a; Then a = a + 1; While a double plus before a variable will increment before the rest of the expression. y = ++a * a ; is equivalent to a = a + 1; Then y= 5 * a; The decrement operator works in a similar way. a ; a ; is equivalent to a = a 1; There are other assignment operators. a += 10; is equivalent to a = a + 10; a -= 10; is equivalent to a = a - 10; a *= 10; is equivalent to a = a * 10; a /= 10; is equivalent to a = a / 10; a %= 10; is equivalent to a = a % 10; a >>= 3; is equivalent to a = a >> 3; a <<= 3; is equivalent to a = a << 3; a &= 0b10; is equivalent to a = a & 0b10; a = 0x10; is equivalent to a = a 0x10; a ^= 0x10; is equivalent to a = a ^ 0x10; 10

11 Type Conversion Normally, all the variables used in any expression are of the same type. However it is sometimes necessary to convert a variable from one type to another. To do this you put the name of the type that you want to convert to, in brackets, in front of the expression. Example int a; unsigned long b; a = 2; b = (unsigned long)a*5; or b = (unsigned long)(a*5); // convert a to unsigned long // convert (a*5) to unsigned long Comments The text between /* and */ are comments. These are pieces of text that are ignored by the compiler, but make the program more understandable. You can also use // to indicate that anything following on this line is a comment. /* This is a comment */ // and so is this 11

12 Functions Functions are collections of code that can be called and executed from other parts of the program. Take for example a function called fname declared below : int fname (int a, int b) int c; // Local variables at the top c = a + b; // Executable code below return c ; The purpose of this function is to add together two integers. To use fname in your program, you would use something like this d = fname(3,5); Where d is of type int. When the function is called, 3 is copied into a and 5 is coped into b. The return line defines the value that the function gives back to the calling code. In this case the value in c is copied into the variable d. The int before fname in the declaration of the function defines the type of variable that the function returns. Functions can only return one item. void Sometimes function are required that don t return any value. In this case the dummy variable type void can be used. void f2 (void)... Void means empty. So in this case the function does need any parameters and does not return any value either. To use it you would insert the following into your code. f2(); 12

13 The Main Function All executable code within a C program must be within a function. The top level function is always called main. The main function is defined in this form. int main (void)... //Put your code in here Any other functions should be defined outside and below main. Pre-Declaration The C compiler works through the text of a program from top to bottom. So for the compiler to work correctly, it needs to know about any functions or variables before it is used. The convention in C is that main is the first function in the program, but you also predeclare each of the other functions before main. A pre-declaration is just a copy of the top line of the original definition, but with a semicolon at the end. For example, a pre-declaration of fname looks like this. int fname (int a, int b); // Pre-declaration of fname /* The Main Program */ int main (void)... // What ever. /* Definitions of other functions */ int fname (int a, int b) // The definition of fname int c; c = a + b; return c ; 13

14 Global and Local Variables Where a variable is declared determines where it can be used. A variable declared inside a function is local to that function and can only be used within the function. If a variable is declared outside of any function, then it is a global variable. These can be used in any function. /* global variables */ int a; unsigned long b; int main (void) /* local variables */ int c; unsigned char s; /* The program code */ a = 2; c = a + 5; Global variables are easier to read with the debugger. For this reason they tend to be used a lot more in this course than is normal. External Variables It is also possible to use global variables that have been define in another file. extern unsigned char s; Says that a variable s of type char exists and can be used in this file, but the actual declaration of the variable has been define else where in another file. 14

15 Flow Control For Loop The general form of a for loop is :- for( <initialise> ; <condition> ; <increment>) <statements> <initialise> <condition> <increment> <statements> What to set on the first loop. Must be true to execute loop. The change at the end of each loop. The code to be executed each time round the loop. Example of a for loop a = 0; for (x = 0; x < 10; x++) a += x; x = 0 The first time round the loop, x is set to zero. x < 10 The loop will carry on executing while x is less than 10. x++ After each loop, x is incremented by one. So this loop adds the integers 0 to 9. for( x = 10; x > 0 ; x ); Note the terminating semicolon. There are no statements to execute. This counts down from 10 to 1. It is a short delay. 15

16 While Loop A while loop will keep executing the code in the loop while a condition is true. For example a = 0; x = 0; while (x < 10) a += x; x++; Again, this loop adds the integers 0 to 9. While can also have an empty loop. c = 10; while( c!= 0); c is decremented until c is equal to zero. In C, zero is treated as false, any other positive number is true. So while(1) etc Will loop forever. Do While Loops Do while loops are like a while loop, except that the condition is tested at the end, instead of the beginning of the loop. do a = GPIOC->PDIR & 0b01000 ; while( a == 0); Wait for bit 3 of Port C to go low. 16

17 If statement This is used to execute a set of statements only if a condition is true. For example if ( a > b) vout = 0; // executed if a is greater than b There is another type of if statement that contains an alternative if the condition is false. if ( a > b) vout = 0; else vout = 0xff; // executed if a is greater than b // executed if a is not greater than b If a is not greater than b, the else part is executed 17

18 Switch statement A switch statement is used to select from a number of different options. In the example below, we use an unsigned char called a to choose which piece of code to runs. switch(a) case 0: break; // any statements to be executed //when a = 0 go in here // jump to the end of the switch statement case 1: // statements executed when a = 1 go in here break; // jump to the end of the switch statement case 5: break; // statements executed when a = 5 go in here // jump to the end of the switch statement case 10: case 11: case 20: // Code executed if a is 10, 11 or 12. break; // jump to the end of the switch statement default; break; // Code executed if a is not equal to any // of the above options. 18

19 Pointers The address operator, &, allows you to find the address of a variable. Here it is used to store the address of the variable x into p. p = &x; The variable p is called a pointer. A pointer is a variable used to hold the address of another variable. You can then write to the memory location pointed to by p. *p = 12; The operator * indicates the contents of the address in the following pointer. In this case, as the variable x is stored at the address pointed to by p, it sets the variable x to 12. For this to work, C needs to know what type of variable the pointer is pointing at. If p is a pointer to an int, it needs to be defined as follows : int *p; This says that the content of the address pointed to by p is of type int. In other words, *p is of type int. Type conversion to a pointer To write or read from a specified memory location, you cast the address into a pointer. p = ( int *) 0xf100; This turns the address into a pointer to an int, then stores the pointer into the variable p. Then you can use *p to read or write to the memory location. 19

20 Pass by Reference So far, the mechanism used to get information into and out of a function is called pass by value. Only the value of the number is transferred into the function and only one value is returned. Pass by reference means that you pass the location of the number in memory to the function instead of the value. int x; int y; add_sub(10, 6, &x, &y); etc void add_sub(int a, int b,int *sum, int *diff) *sum = a + b; // Store directly into address *diff = a - b; Here the address of x and y are passed to the the function. sum is a pointer to x and diff is a pointer to y. So that the function writes the result of the assignment directly into the variables x and y. Passing by reference is a two way process. It can be used to pass information into and out of a function. Functions in C can return only one value, so pass by reference is used as a method to get multiple results out of a function. 20

21 Arrays unsigned char data[64]; data[0] = a; a = data[63]; This declares an array with 64 elements of type unsigned char. The elements are numbered 0 to 63. Copies the variable a into element 0 of the array data. Sets a equal to element 63 of data. for(i = 0 ; i < 64 ; i++) data[i] = 0; Sets each element of data to zero one at a time. You can also specify the contents of an array when it is created. The example below shows how to create an array that contains the numbers 1, 2, 3 and 4. int myarray[4] = 1,2,3,4; This is the equivalent to int myarray[4] ; myarray[0] = 1; myarray[1] = 2; myarray[2] = 3; myarray[3] = 4; 21

22 Passing Arrays to a Function Using an array inside a function in C is not the same as in MATLAB. Instead of passing the whole contents of an array into a function, you pass a pointer to the array. For example, the following function finds the sum of the first three elements in an array. int sum3(int a[]) int s; s = a[0] + a[1] + a[2] ; return s; To use this function on the array called myarray, defined on the previous page, you pass the name of the array. x = sum3(myarray); The array name is also a pointer to the first element in an array. As a pointer is being used, you can also use this mechanism to change the content of an array. Any writes to the array inside the function will update the original array. void zero3(int a[]) a[0] = 0; a[1] = 0; a[2] = 0; 22

23 Arrays and Pointer Arithmetic A pointer is not exactly the same as the address. In some ways it is more like an array. For example, suppose that we have the following array. int a[10]; The symbol a is a pointer the first first element of the array a[0]. a + 1 is a pointer to a[1]. In general, x = *(a + k); is the equivalent to x = a[k]; When you add one to a pointer, you do not add one to the address. Instead you move to the address of the next variable in memory. As some variables require several address locations of storage, this is not necessary the next address in memory. For example :- if the variable p is a pointer to an int and p is pointed at an address 0xf100. p = ( int *) 0xf100; Then p + 1 will point to 0xf104. Four address locations are required to store an int, so the address will increase by 4. Warning The C compiler does not check that you are doing something stupid. Writing data to a memory location without knowing what you are writing to can cause all sorts of problems. You could overwrite another variable or crash the computer. For example, suppose we have defined the following variables int a[10]; int b; int *p; Then all the following will set a memory location to zero, but we do not know what is located in that memory address. p = &b; p++; *p = 0; *(a-2) = 0; a[10] = 0; As the last element is a[9]. 23

24 Structures To define a structure called mystructure, with three fields a, b and c, all of type unsigned int. struct unsigned int a; unsigned int b; unsigned int c; mystructure; To write to a field mystructure.a = 3*n + 24; You can use a structure field anywhere you could use a variable. y = mystructure.a + 2*mystructure.b + 3*mystructure.c ; If is often more convenient to define your own data type that can be used throughout your code. For example typedef struct unsigned int a; unsigned int b; unsigned int c; my_type; Then you could create three structures, all of the above type. my_type x; my_type y; my_type z; As before, you can use the fields of these structures where every you would use a variable. For example. z.a = x.c + y.b; 24

25 Pointers to Structures Supposing that we define a pointer to a structure. my_type *ps; ps = &x; Where my_type and x are as defined on the previous page. To access the field a of the structure, we could use. (*ps).a However, that is a bit cumbersome. Instead, C has its own notation for accessing a field of a point to structure. ps->a For example, the follow function adds the three fields together. int sum_fields(my_type *ps) int s; s = ps->a + ps->b + ps ->c; return s; 25

26 Compilers Linkers and Make As your program gets more complicated, you will find that you want to combine several C files into one program. Each.c file needs to be converted into machine code by the compiler. Then the machine code is linked together into one program ready to download into the microprocessor. main.c camera.c motor.c Source code Compiler Compiler Compiler main.o camera.o motor.o Machine code Linker Project.axf File to download If you had to do this by hand it becomes tedious. However, there is a program called make that will automatically do all the above for you. Make will only do what is absolutely necessary. It will only compile a.c file if the file has changed since it was last compiled. Selecting Build in Xpresso runs make to compile and link the whole project. 26

27 Header files The compiler will not know anything about any function defined within another file, unless you declare what the function is at the top of your file. There is however an easy way to do this using header files. For example, suppose that the function main is in a file called main.c. In addition you have another file called adc.c that contains two functions called adcinit and adcread. To use these functions in main, you first produce a header file called adc.h that contained the declaration for each for the functions. void adcinit(void); char adcread(void); Then you could include these declarations by adding the following to the top of main.c : #include adc.h Any command beginning with a hash (#) is picked out by the C preprocessor that is run before the compiler. The preprocessor will copy the whole of adc.h into main.c in place of the #include line. See the diagram on the next page. The filename in quotes means that this is a header file that you have written and can be found in the local directory. There are other header files that are provided by the manufacturer. These are all in a directory called include within the installation files. To use these files, you put the file name between angled brackets. #include <stdio.h> This header contains functions in the I/O library such as printf. 27

28 main.c #include adc.h adc.h void adcinit(void); char adcread(void); C preprocessor void adcinit(void); char adcread(void); The preprocessor has replaced the #include with the contents of the header file adc.h Compiler main.o Machine code version of main.c adc.o Linker Project.axf 28

29 Definitions and Macros There is another preprocessed command that can help to make your program easier to understand. The #define command searches your code for an item and replaces it with another item. For example #define TRUE 1 searches the program from TRUE and replaces it with 1. You could then write while(true) c++; Which will count up forever. A macro is a definition that contains an argument. For example, consider the two following definitions. #define LED 29 #define BIT(n) 1<<n BIT is a macro that produces a constant with the n th bit set and all other bits zero. The red LED is connected to bit 29 of port E. To toggle the LED on or off, we write 1 to bit 29 of the Port Toggle Output Register (PTOR) of port E. GPIOE->PTOR = 1<<29; We can do the same by using the BIT macro. GPIOE->PTOR = BIT(29); We can also use the LED definition with BIT. GPIOE->PTOR = BIT(LED); After processing with the C preprocessor, the three different lines of code above will all look the same. 29

30 Program Structure and Layout The following shows the how various components of a program fit together. Preprocessor commands Standard preprocessor commands Your preprocessor commands Predeclaration of functions other than main. Global variable declarations Main Local variables declarations Executable code Other Functions Most of this structure is automatically created when you start a new project. You will be adding your own.c files to a project. To use the microcontroller internal registers within these files, you must include the header file containing the definitions and register locations. #include "MKL46Z4.h" 30

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

General Syntax. Operators. Variables. Arithmetic. Comparison. Assignment. Boolean. Types. Syntax int i; float j = 1.35; int k = (int) j;

General Syntax. Operators. Variables. Arithmetic. Comparison. Assignment. Boolean. Types. Syntax int i; float j = 1.35; int k = (int) j; General Syntax Statements are the basic building block of any C program. They can assign a value to a variable, or make a comparison, or make a function call. They must be terminated by a semicolon. Every

More information

ME 461 C review Session Fall 2009 S. Keres

ME 461 C review Session Fall 2009 S. Keres ME 461 C review Session Fall 2009 S. Keres DISCLAIMER: These notes are in no way intended to be a complete reference for the C programming material you will need for the class. They are intended to help

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

C: How to Program. Week /Mar/05

C: How to Program. Week /Mar/05 1 C: How to Program Week 2 2007/Mar/05 Chapter 2 - Introduction to C Programming 2 Outline 2.1 Introduction 2.2 A Simple C Program: Printing a Line of Text 2.3 Another Simple C Program: Adding Two Integers

More information

DEPARTMENT OF MATHS, MJ COLLEGE

DEPARTMENT OF MATHS, MJ COLLEGE T. Y. B.Sc. Mathematics MTH- 356 (A) : Programming in C Unit 1 : Basic Concepts Syllabus : Introduction, Character set, C token, Keywords, Constants, Variables, Data types, Symbolic constants, Over flow,

More information

Chapter 2 - Introduction to C Programming

Chapter 2 - Introduction to C Programming Chapter 2 - Introduction to C Programming 2 Outline 2.1 Introduction 2.2 A Simple C Program: Printing a Line of Text 2.3 Another Simple C Program: Adding Two Integers 2.4 Memory Concepts 2.5 Arithmetic

More information

Have examined process Creating program Have developed program Written in C Source code

Have examined process Creating program Have developed program Written in C Source code Preprocessing, Compiling, Assembling, and Linking Introduction In this lesson will examine Architecture of C program Introduce C preprocessor and preprocessor directives How to use preprocessor s directives

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

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

ANSI C Programming Simple Programs

ANSI C Programming Simple Programs ANSI C Programming Simple Programs /* This program computes the distance between two points */ #include #include #include main() { /* Declare and initialize variables */ double

More information

C Language Programming

C Language Programming Experiment 2 C Language Programming During the infancy years of microprocessor based systems, programs were developed using assemblers and fused into the EPROMs. There used to be no mechanism to find what

More information

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

Basic C Programming (2) Bin Li Assistant Professor Dept. of Electrical, Computer and Biomedical Engineering University of Rhode Island Basic C Programming (2) Bin Li Assistant Professor Dept. of Electrical, Computer and Biomedical Engineering University of Rhode Island Data Types Basic Types Enumerated types The type void Derived types

More information

Fundamental of Programming (C)

Fundamental of Programming (C) Borrowed from lecturer notes by Omid Jafarinezhad Fundamental of Programming (C) Lecturer: Vahid Khodabakhshi Lecture 3 Constants, Variables, Data Types, And Operations Department of Computer Engineering

More information

printf( Please enter another number: ); scanf( %d, &num2);

printf( Please enter another number: ); scanf( %d, &num2); CIT 593 Intro to Computer Systems Lecture #13 (11/1/12) Now that we've looked at how an assembly language program runs on a computer, we're ready to move up a level and start working with more powerful

More information

BLM2031 Structured Programming. Zeyneb KURT

BLM2031 Structured Programming. Zeyneb KURT BLM2031 Structured Programming Zeyneb KURT 1 Contact Contact info office : D-219 e-mail zeynebkurt@gmail.com, zeyneb@ce.yildiz.edu.tr When to contact e-mail first, take an appointment What to expect help

More information

Computer Organization & Systems Exam I Example Questions

Computer Organization & Systems Exam I Example Questions Computer Organization & Systems Exam I Example Questions 1. Pointer Question. Write a function char *circle(char *str) that receives a character pointer (which points to an array that is in standard C

More information

CSE 351: The Hardware/Software Interface. Section 2 Integer representations, two s complement, and bitwise operators

CSE 351: The Hardware/Software Interface. Section 2 Integer representations, two s complement, and bitwise operators CSE 351: The Hardware/Software Interface Section 2 Integer representations, two s complement, and bitwise operators Integer representations In addition to decimal notation, it s important to be able to

More information

9/5/2018. Overview. The C Programming Language. Transitioning to C from Python. Why C? Hello, world! Programming in C

9/5/2018. Overview. The C Programming Language. Transitioning to C from Python. Why C? Hello, world! Programming in C Overview The C Programming Language (with material from Dr. Bin Ren, William & Mary Computer Science) Motivation Hello, world! Basic Data Types Variables Arithmetic Operators Relational Operators Assignments

More information

EL6483: Brief Overview of C Programming Language

EL6483: Brief Overview of C Programming Language EL6483: Brief Overview of C Programming Language EL6483 Spring 2016 EL6483 EL6483: Brief Overview of C Programming Language Spring 2016 1 / 30 Preprocessor macros, Syntax for comments Macro definitions

More information

Introduction to C Programming. Chih-Wei Tang ( 唐之瑋 ) Department of Communication Engineering National Central University JhongLi, Taiwan

Introduction to C Programming. Chih-Wei Tang ( 唐之瑋 ) Department of Communication Engineering National Central University JhongLi, Taiwan Introduction to C Programming Chih-Wei Tang ( 唐之瑋 ) Department of Communication Engineering National Central University JhongLi, Taiwan Outline Printing texts Adding 2 integers Comparing 2 integers C.E.,

More information

The C Programming Language. (with material from Dr. Bin Ren, William & Mary Computer Science)

The C Programming Language. (with material from Dr. Bin Ren, William & Mary Computer Science) The C Programming Language (with material from Dr. Bin Ren, William & Mary Computer Science) 1 Overview Motivation Hello, world! Basic Data Types Variables Arithmetic Operators Relational Operators Assignments

More information

Objectives. Chapter 2: Basic Elements of C++ Introduction. Objectives (cont d.) A C++ Program (cont d.) A C++ Program

Objectives. Chapter 2: Basic Elements of C++ Introduction. Objectives (cont d.) A C++ Program (cont d.) A C++ Program Objectives Chapter 2: Basic Elements of C++ In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates

More information

Chapter 2: Basic Elements of C++

Chapter 2: Basic Elements of C++ Chapter 2: Basic Elements of C++ Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates

More information

Chapter 2: Basic Elements of C++ Objectives. Objectives (cont d.) A C++ Program. Introduction

Chapter 2: Basic Elements of C++ Objectives. Objectives (cont d.) A C++ Program. Introduction Chapter 2: Basic Elements of C++ C++ Programming: From Problem Analysis to Program Design, Fifth Edition 1 Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers

More information

More on C programming

More on C programming Applied mechatronics More on C programming Sven Gestegård Robertz sven.robertz@cs.lth.se Department of Computer Science, Lund University 2017 Outline 1 Pointers and structs 2 On number representation Hexadecimal

More information

Creating a C++ Program

Creating a C++ Program Program A computer program (also software, or just a program) is a sequence of instructions written in a sequence to perform a specified task with a computer. 1 Creating a C++ Program created using an

More information

Programming for Engineers Introduction to C

Programming for Engineers Introduction to C Programming for Engineers Introduction to C ICEN 200 Spring 2018 Prof. Dola Saha 1 Simple Program 2 Comments // Fig. 2.1: fig02_01.c // A first program in C begin with //, indicating that these two lines

More information

C Programming Language (Chapter 2 of K&R) Variables and Constants

C Programming Language (Chapter 2 of K&R) Variables and Constants C Programming Language (Chapter 2 of K&R) Types, Operators and Expressions Variables and Constants Basic objects manipulated by programs Declare before use: type var1, var2, int x, y, _X, x11, buffer;

More information

EDIABAS BEST/2 LANGUAGE DESCRIPTION. VERSION 6b. Electronic Diagnostic Basic System EDIABAS - BEST/2 LANGUAGE DESCRIPTION

EDIABAS BEST/2 LANGUAGE DESCRIPTION. VERSION 6b. Electronic Diagnostic Basic System EDIABAS - BEST/2 LANGUAGE DESCRIPTION EDIABAS Electronic Diagnostic Basic System BEST/2 LANGUAGE DESCRIPTION VERSION 6b Copyright BMW AG, created by Softing AG BEST2SPC.DOC CONTENTS CONTENTS...2 1. INTRODUCTION TO BEST/2...5 2. TEXT CONVENTIONS...6

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

UNIT - I. Introduction to C Programming. BY A. Vijay Bharath

UNIT - I. Introduction to C Programming. BY A. Vijay Bharath UNIT - I Introduction to C Programming Introduction to C C was originally developed in the year 1970s by Dennis Ritchie at Bell Laboratories, Inc. C is a general-purpose programming language. It has been

More information

UNIT- 3 Introduction to C++

UNIT- 3 Introduction to C++ UNIT- 3 Introduction to C++ C++ Character Sets: Letters A-Z, a-z Digits 0-9 Special Symbols Space + - * / ^ \ ( ) [ ] =!= . $, ; : %! &? _ # = @ White Spaces Blank spaces, horizontal tab, carriage

More information

Fundamental Data Types. CSE 130: Introduction to Programming in C Stony Brook University

Fundamental Data Types. CSE 130: Introduction to Programming in C Stony Brook University Fundamental Data Types CSE 130: Introduction to Programming in C Stony Brook University Program Organization in C The C System C consists of several parts: The C language The preprocessor The compiler

More information

Embedded Systems - FS 2018

Embedded Systems - FS 2018 Institut für Technische Informatik und Kommunikationsnetze Prof. L. Thiele Embedded Systems - FS 2018 Lab 0 Date : 28.2.2018 Prelab Filling the gaps Goals of this Lab You are expected to be already familiar

More information

CS113: Lecture 3. Topics: Variables. Data types. Arithmetic and Bitwise Operators. Order of Evaluation

CS113: Lecture 3. Topics: Variables. Data types. Arithmetic and Bitwise Operators. Order of Evaluation CS113: Lecture 3 Topics: Variables Data types Arithmetic and Bitwise Operators Order of Evaluation 1 Variables Names of variables: Composed of letters, digits, and the underscore ( ) character. (NO spaces;

More information

Full file at C How to Program, 6/e Multiple Choice Test Bank

Full file at   C How to Program, 6/e Multiple Choice Test Bank 2.1 Introduction 2.2 A Simple Program: Printing a Line of Text 2.1 Lines beginning with let the computer know that the rest of the line is a comment. (a) /* (b) ** (c) REM (d)

More information

CS16 Exam #1 7/17/ Minutes 100 Points total

CS16 Exam #1 7/17/ Minutes 100 Points total CS16 Exam #1 7/17/2012 75 Minutes 100 Points total Name: 1. (10 pts) Write the definition of a C function that takes two integers `a` and `b` as input parameters. The function returns an integer holding

More information

C Programming Language. Microcomputer Architecture and Interfacing Colorado School of Mines Professor William Hoff

C Programming Language. Microcomputer Architecture and Interfacing Colorado School of Mines Professor William Hoff C Programming Language 1 C C is better to use than assembly for embedded systems programming. You can program at a higher level of logic than in assembly, so programs are shorter and easier to understand.

More information

Computer System and programming in C

Computer System and programming in C 1 Basic Data Types Integral Types Integers are stored in various sizes. They can be signed or unsigned. Example Suppose an integer is represented by a byte (8 bits). Leftmost bit is sign bit. If the sign

More information

Computers Programming Course 6. Iulian Năstac

Computers Programming Course 6. Iulian Năstac Computers Programming Course 6 Iulian Năstac Recap from previous course Data types four basic arithmetic type specifiers: char int float double void optional specifiers: signed, unsigned short long 2 Recap

More information

UIC. C Programming Primer. Bharathidasan University

UIC. C Programming Primer. Bharathidasan University C Programming Primer UIC C Programming Primer Bharathidasan University Contents Getting Started 02 Basic Concepts. 02 Variables, Data types and Constants...03 Control Statements and Loops 05 Expressions

More information

c) Comments do not cause any machine language object code to be generated. d) Lengthy comments can cause poor execution-time performance.

c) Comments do not cause any machine language object code to be generated. d) Lengthy comments can cause poor execution-time performance. 2.1 Introduction (No questions.) 2.2 A Simple Program: Printing a Line of Text 2.1 Which of the following must every C program have? (a) main (b) #include (c) /* (d) 2.2 Every statement in C

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

2/29/2016. Definition: Computer Program. A simple model of the computer. Example: Computer Program. Data types, variables, constants

2/29/2016. Definition: Computer Program. A simple model of the computer. Example: Computer Program. Data types, variables, constants Data types, variables, constants Outline.1 Introduction. Text.3 Memory Concepts.4 Naming Convention of Variables.5 Arithmetic in C.6 Type Conversion Definition: Computer Program A Computer program is a

More information

LESSON 1. A C program is constructed as a sequence of characters. Among the characters that can be used in a program are:

LESSON 1. A C program is constructed as a sequence of characters. Among the characters that can be used in a program are: LESSON 1 FUNDAMENTALS OF C The purpose of this lesson is to explain the fundamental elements of the C programming language. C like other languages has all alphabet and rules for putting together words

More information

2/5/2018. Expressions are Used to Perform Calculations. ECE 220: Computer Systems & Programming. Our Class Focuses on Four Types of Operator in C

2/5/2018. Expressions are Used to Perform Calculations. ECE 220: Computer Systems & Programming. Our Class Focuses on Four Types of Operator in C University of Illinois at Urbana-Champaign Dept. of Electrical and Computer Engineering ECE 220: Computer Systems & Programming Expressions and Operators in C (Partially a Review) Expressions are Used

More information

Chapter 1 & 2 Introduction to C Language

Chapter 1 & 2 Introduction to C Language 1 Chapter 1 & 2 Introduction to C Language Copyright 2007 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 1 & 2 - Introduction to C Language 2 Outline 1.1 The History

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

/* defines are mostly used to declare constants */ #define MAX_ITER 10 // max number of iterations

/* defines are mostly used to declare constants */ #define MAX_ITER 10 // max number of iterations General Framework of a C program for MSP430 /* Compiler directives (includes & defines) come first */ // Code you write in this class will need this include #include msp430.h // CCS header for MSP430 family

More information

CS201 Some Important Definitions

CS201 Some Important Definitions CS201 Some Important Definitions For Viva Preparation 1. What is a program? A program is a precise sequence of steps to solve a particular problem. 2. What is a class? We write a C++ program using data

More information

Beginning C Programming for Engineers

Beginning C Programming for Engineers Beginning Programming for Engineers R. Lindsay Todd Lecture 6: Bit Operations R. Lindsay Todd () Beginning Programming for Engineers Beg 6 1 / 32 Outline Outline 1 Place Value Octal Hexadecimal Binary

More information

C Syntax Out: 15 September, 1995

C Syntax Out: 15 September, 1995 Burt Rosenberg Math 220/317: Programming II/Data Structures 1 C Syntax Out: 15 September, 1995 Constants. Integer such as 1, 0, 14, 0x0A. Characters such as A, B, \0. Strings such as "Hello World!\n",

More information

Course Outline Introduction to C-Programming

Course Outline Introduction to C-Programming ECE3411 Fall 2015 Lecture 1a. Course Outline Introduction to C-Programming Marten van Dijk, Syed Kamran Haider Department of Electrical & Computer Engineering University of Connecticut Email: {vandijk,

More information

C OVERVIEW. C Overview. Goals speed portability allow access to features of the architecture speed

C OVERVIEW. C Overview. Goals speed portability allow access to features of the architecture speed C Overview C OVERVIEW Goals speed portability allow access to features of the architecture speed C fast executables allows high-level structure without losing access to machine features many popular languages

More information

C OVERVIEW BASIC C PROGRAM STRUCTURE. C Overview. Basic C Program Structure

C OVERVIEW BASIC C PROGRAM STRUCTURE. C Overview. Basic C Program Structure C Overview Basic C Program Structure C OVERVIEW BASIC C PROGRAM STRUCTURE Goals The function main( )is found in every C program and is where every C program begins speed execution portability C uses braces

More information

CENG 447/547 Embedded and Real-Time Systems. Review of C coding and Soft Eng Concepts

CENG 447/547 Embedded and Real-Time Systems. Review of C coding and Soft Eng Concepts CENG 447/547 Embedded and Real-Time Systems Review of C coding and Soft Eng Concepts Recall (C-style coding syntax) ; - Indicate the end of an expression {} - Used to delineate when a sequence of elements

More information

P.G.TRB - COMPUTER SCIENCE. c) data processing language d) none of the above

P.G.TRB - COMPUTER SCIENCE. c) data processing language d) none of the above P.G.TRB - COMPUTER SCIENCE Total Marks : 50 Time : 30 Minutes 1. C was primarily developed as a a)systems programming language b) general purpose language c) data processing language d) none of the above

More information

Fundamentals of Programming

Fundamentals of Programming Fundamentals of Programming Lecture 3 - Constants, Variables, Data Types, And Operations Lecturer : Ebrahim Jahandar Borrowed from lecturer notes by Omid Jafarinezhad Outline C Program Data types Variables

More information

Page 1. Where Have We Been? Chapter 2 Representing and Manipulating Information. Why Don t Computers Use Base 10?

Page 1. Where Have We Been? Chapter 2 Representing and Manipulating Information. Why Don t Computers Use Base 10? Where Have We Been? Class Introduction Great Realities of Computing Int s are not Integers, Float s are not Reals You must know assembly Memory Matters Performance! Asymptotic Complexity It s more than

More information

About Codefrux While the current trends around the world are based on the internet, mobile and its applications, we try to make the most out of it. As for us, we are a well established IT professionals

More information

Embedded Systems. Introduction. The C Language. Introduction. Why C instead ASM. Introduction to C Embedded Programming language

Embedded Systems. Introduction. The C Language. Introduction. Why C instead ASM. Introduction to C Embedded Programming language Introduction Embedded Systems Introduction to C Embedded Programming language Why C instead ASM 1. C is a high level language, it is easier to write and read than assembly codes. 2. You don't have to think

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

Agenda. CS 61C: Great Ideas in Computer Architecture. Lecture 2: Numbers & C Language 8/29/17. Recap: Binary Number Conversion

Agenda. CS 61C: Great Ideas in Computer Architecture. Lecture 2: Numbers & C Language 8/29/17. Recap: Binary Number Conversion CS 61C: Great Ideas in Computer Architecture Lecture 2: Numbers & C Language Krste Asanović & Randy Katz http://inst.eecs.berkeley.edu/~cs61c Numbers wrap-up This is not on the exam! Break C Primer Administrivia,

More information

Objectives. In this chapter, you will:

Objectives. In this chapter, you will: Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates arithmetic expressions Learn about

More information

INTRODUCTION 1 AND REVIEW

INTRODUCTION 1 AND REVIEW INTRODUTION 1 AND REVIEW hapter SYS-ED/ OMPUTER EDUATION TEHNIQUES, IN. Programming: Advanced Objectives You will learn: Program structure. Program statements. Datatypes. Pointers. Arrays. Structures.

More information

CS 61C: Great Ideas in Computer Architecture. Lecture 2: Numbers & C Language. Krste Asanović & Randy Katz

CS 61C: Great Ideas in Computer Architecture. Lecture 2: Numbers & C Language. Krste Asanović & Randy Katz CS 61C: Great Ideas in Computer Architecture Lecture 2: Numbers & C Language Krste Asanović & Randy Katz http://inst.eecs.berkeley.edu/~cs61c Numbers wrap-up This is not on the exam! Break C Primer Administrivia,

More information

Review of the C Programming Language for Principles of Operating Systems

Review of the C Programming Language for Principles of Operating Systems Review of the C Programming Language for Principles of Operating Systems Prof. James L. Frankel Harvard University Version of 7:26 PM 4-Sep-2018 Copyright 2018, 2016, 2015 James L. Frankel. All rights

More information

Chapter 12 Variables and Operators

Chapter 12 Variables and Operators Chapter 12 Variables and Operators Basic C Elements Variables Named, typed data items Operators Predefined actions performed on data items Combined with variables to form expressions, statements Statements

More information

Outline. Parts 1 to 3 introduce and sketch out the ideas of OOP. Part 5 deals with these ideas in closer detail.

Outline. Parts 1 to 3 introduce and sketch out the ideas of OOP. Part 5 deals with these ideas in closer detail. OOP in Java 1 Outline 1. Getting started, primitive data types and control structures 2. Classes and objects 3. Extending classes 4. Using some standard packages 5. OOP revisited Parts 1 to 3 introduce

More information

Arithmetic and Bitwise Operations on Binary Data

Arithmetic and Bitwise Operations on Binary Data Arithmetic and Bitwise Operations on Binary Data CSCI 2400: Computer Architecture ECE 3217: Computer Architecture and Organization Instructor: David Ferry Slides adapted from Bryant & O Hallaron s slides

More information

Computer Architecture and System Software Lecture 02: Overview of Computer Systems & Start of Chapter 2

Computer Architecture and System Software Lecture 02: Overview of Computer Systems & Start of Chapter 2 Computer Architecture and System Software Lecture 02: Overview of Computer Systems & Start of Chapter 2 Instructor: Rob Bergen Applied Computer Science University of Winnipeg Announcements Website is up

More information

EL2310 Scientific Programming

EL2310 Scientific Programming Lecture 7: Introduction to C (pronobis@kth.se) Overview Overview Lecture 7: Introduction to C Wrap Up Basic Datatypes and printf Branching and Loops in C Constant values Wrap Up Lecture 7: Introduction

More information

First of all, it is a variable, just like other variables you studied

First of all, it is a variable, just like other variables you studied Pointers: Basics What is a pointer? First of all, it is a variable, just like other variables you studied So it has type, storage etc. Difference: it can only store the address (rather than the value)

More information

DETAILED SYLLABUS INTRODUCTION TO C LANGUAGE

DETAILED SYLLABUS INTRODUCTION TO C LANGUAGE COURSE TITLE C LANGUAGE DETAILED SYLLABUS SR.NO NAME OF CHAPTERS & DETAILS HOURS ALLOTTED 1 INTRODUCTION TO C LANGUAGE About C Language Advantages of C Language Disadvantages of C Language A Sample Program

More information

Unit 3. Operators. School of Science and Technology INTRODUCTION

Unit 3. Operators. School of Science and Technology INTRODUCTION INTRODUCTION Operators Unit 3 In the previous units (unit 1 and 2) you have learned about the basics of computer programming, different data types, constants, keywords and basic structure of a C program.

More information

These are reserved words of the C language. For example int, float, if, else, for, while etc.

These are reserved words of the C language. For example int, float, if, else, for, while etc. Tokens in C Keywords These are reserved words of the C language. For example int, float, if, else, for, while etc. Identifiers An Identifier is a sequence of letters and digits, but must start with a letter.

More information

Programming, numerics and optimization

Programming, numerics and optimization Programming, numerics and optimization Lecture A-2: Programming basics II Łukasz Jankowski ljank@ippt.pan.pl Institute of Fundamental Technological Research Room 4.32, Phone +22.8261281 ext. 428 March

More information

Lecture 4 CSE July 1992

Lecture 4 CSE July 1992 Lecture 4 CSE 110 6 July 1992 1 More Operators C has many operators. Some of them, like +, are binary, which means that they require two operands, as in 4 + 5. Others are unary, which means they require

More information

Chapter 03: Computer Arithmetic. Lesson 09: Arithmetic using floating point numbers

Chapter 03: Computer Arithmetic. Lesson 09: Arithmetic using floating point numbers Chapter 03: Computer Arithmetic Lesson 09: Arithmetic using floating point numbers Objective To understand arithmetic operations in case of floating point numbers 2 Multiplication of Floating Point Numbers

More information

Chapter 3: Operators, Expressions and Type Conversion

Chapter 3: Operators, Expressions and Type Conversion 101 Chapter 3 Operators, Expressions and Type Conversion Chapter 3: Operators, Expressions and Type Conversion Objectives To use basic arithmetic operators. To use increment and decrement operators. To

More information

ISA 563 : Fundamentals of Systems Programming

ISA 563 : Fundamentals of Systems Programming ISA 563 : Fundamentals of Systems Programming Variables, Primitive Types, Operators, and Expressions September 4 th 2008 Outline Define Expressions Discuss how to represent data in a program variable name

More information

Lecture 3. More About C

Lecture 3. More About C Copyright 1996 David R. Hanson Computer Science 126, Fall 1996 3-1 Lecture 3. More About C Programming languages have their lingo Programming language Types are categories of values int, float, char Constants

More information

CprE 288 Introduction to Embedded Systems Exam 1 Review. 1

CprE 288 Introduction to Embedded Systems Exam 1 Review.  1 CprE 288 Introduction to Embedded Systems Exam 1 Review http://class.ece.iastate.edu/cpre288 1 Overview of Today s Lecture Announcements Exam 1 Review http://class.ece.iastate.edu/cpre288 2 Announcements

More information

CS107 Handout 13 Spring 2008 April 18, 2008 Computer Architecture: Take II

CS107 Handout 13 Spring 2008 April 18, 2008 Computer Architecture: Take II CS107 Handout 13 Spring 2008 April 18, 2008 Computer Architecture: Take II Example: Simple variables Handout written by Julie Zelenski and Nick Parlante A variable is a location in memory. When a variable

More information

CS201- Introduction to Programming Latest Solved Mcqs from Midterm Papers May 07,2011. MIDTERM EXAMINATION Spring 2010

CS201- Introduction to Programming Latest Solved Mcqs from Midterm Papers May 07,2011. MIDTERM EXAMINATION Spring 2010 CS201- Introduction to Programming Latest Solved Mcqs from Midterm Papers May 07,2011 Lectures 1-22 Moaaz Siddiq Asad Ali Latest Mcqs MIDTERM EXAMINATION Spring 2010 Question No: 1 ( Marks: 1 ) - Please

More information

If you note any errors, typos, etc. with this manual or our software libraries, let us know at

If you note any errors, typos, etc. with this manual or our software libraries, let us know at Oregon State University Robotics Club ORK 2011 Programming Guide Version 1.0 Updated: 10/28/2011 Note: Check back for more revisions and updates soon! If you note any errors, typos, etc. with this manual

More information

C Programming a Q & A Approach

C Programming a Q & A Approach C Programming a Q & A Approach by H.H. Tan, T.B. D Orazio, S.H. Or & Marian M.Y. Choy Chapter 2 Variables, Arithmetic Expressions and Input/Output 2.1 Variables: Naming, Declaring, Assigning and Printing

More information

These are notes for the third lecture; if statements and loops.

These are notes for the third lecture; if statements and loops. These are notes for the third lecture; if statements and loops. 1 Yeah, this is going to be the second slide in a lot of lectures. 2 - Dominant language for desktop application development - Most modern

More information

A complex expression to evaluate we need to reduce it to a series of simple expressions. E.g * 7 =>2+ 35 => 37. E.g.

A complex expression to evaluate we need to reduce it to a series of simple expressions. E.g * 7 =>2+ 35 => 37. E.g. 1.3a Expressions Expressions An Expression is a sequence of operands and operators that reduces to a single value. An operator is a syntactical token that requires an action be taken An operand is an object

More information

Prepared by: Shraddha Modi

Prepared by: Shraddha Modi Prepared by: Shraddha Modi Introduction Operator: An operator is a symbol that tells the Computer to perform certain mathematical or logical manipulations. Expression: An expression is a sequence of operands

More information

ENGINEERING 1020 Introduction to Computer Programming M A Y 2 6, R E Z A S H A H I D I

ENGINEERING 1020 Introduction to Computer Programming M A Y 2 6, R E Z A S H A H I D I ENGINEERING 1020 Introduction to Computer Programming M A Y 2 6, 2 0 1 0 R E Z A S H A H I D I Today s class Constants Assignment statement Parameters and calling functions Expressions Mixed precision

More information

On a 64-bit CPU. Size/Range vary by CPU model and Word size.

On a 64-bit CPU. Size/Range vary by CPU model and Word size. On a 64-bit CPU. Size/Range vary by CPU model and Word size. unsigned short x; //range 0 to 65553 signed short x; //range ± 32767 short x; //assumed signed There are (usually) no unsigned floats or doubles.

More information

Expression and Operator

Expression and Operator Expression and Operator Examples: Two types: Expressions and Operators 3 + 5; x; x=0; x=x+1; printf("%d",x); Function calls The expressions formed by data and operators An expression in C usually has a

More information

Programming in C++ 5. Integral data types

Programming in C++ 5. Integral data types Programming in C++ 5. Integral data types! Introduction! Type int! Integer multiplication & division! Increment & decrement operators! Associativity & precedence of operators! Some common operators! Long

More information

C Programming Language

C Programming Language C Programming Language Advantages over assembly language for microcontrollers: More portable Math functions Readability Maintainability Editing C End-of-line ignored Use line breaks/tabs/indent for readability

More information

SECTION 1: INTRODUCTION. ENGR 112 Introduction to Engineering Computing

SECTION 1: INTRODUCTION. ENGR 112 Introduction to Engineering Computing SECTION 1: INTRODUCTION ENGR 112 Introduction to Engineering Computing 2 Course Overview What is Programming? 3 Programming The implementation of algorithms in a particular computer programming language

More information

Embedded Systems - FS 2018

Embedded Systems - FS 2018 Institut für Technische Informatik und Kommunikationsnetze Prof. L. Thiele Embedded Systems - FS 2018 Sample solution to Lab 0 Date : 28.2.2018 Prelab Filling the gaps Goals of this Lab You are expected

More information

EL2310 Scientific Programming

EL2310 Scientific Programming Lecture 11: Memory, Files and Bitoperations (yaseminb@kth.se) Overview Overview Lecture 11: Memory, Files and Bit operations Main function; reading and writing Bitwise Operations Lecture 11: Memory, Files

More information

Data types, variables, constants

Data types, variables, constants Data types, variables, constants Outline 2.1 Introduction 2.2 A Simple C Program: Printing a Line of Text 2.3 Another Simple C Program: Adding Two Integers 2.4 Memory Concepts 2.5 Arithmetic in C 2.6 Decision

More information