End Presentation


TWiki Slide Show
Next
A bit of C programming

Lecture 3

Uli Raich

First slide Previous Next Last slide
COPYRIGHT © 2025 by the contributing authors
Slide 1 of 6





















TWiki Slide Show
Next
Programming Languages
To make a language a programming language it needs to implement:
  • Assignments
  • Conditional statements
  • loops

First slide Previous Next Last slide
COPYRIGHT © 2025 by the contributing authors
Slide 2 of 6





















TWiki Slide Show
Next
C libraries
C uses a large number of code libraries and you can create C libraries yourself.

These libraries may use special data types, which are defined in include files

Before using the library functions

#include <stdio.h>

or

#include “myOwnIncludeFile.h”

First slide Previous Next Last slide
COPYRIGHT © 2025 by the contributing authors
Slide 3 of 6





















TWiki Slide Show
Next
The C main program
As a first example people usually write the

“Hello World” program

#include <stdio.h>

void main() {

printf(“Hello World!\n”);

}


Let us try to compile and execute this program

First we start the editor, we type and save the program,

then we compile it using the gcc compiler and finally we execute it.

First slide Previous Next Last slide
COPYRIGHT © 2025 by the contributing authors
Slide 4 of 6





















TWiki Slide Show
Next
C data types
  • C has a number of data types:
  • char, short, int, long, float, double
  • unsigned char, unsigned short, unsigned int
  • can be extended to boolean (in C99 you can #include <stdbool.h>
  • No strings! But a pointer to a zero terminated chain of characters
  • struct
  • union
  • enum
And you can define your own data types with typedef

First slide Previous Next Last slide
COPYRIGHT © 2025 by the contributing authors
Slide 5 of 6





















TWiki Slide Show
Next
Assignements
We modify the program to do some calculation:

First slide Previous Next Last slide
COPYRIGHT © 2025 by the contributing authors
Slide 6 of 6





















First slide Previous End Presentation






























-- Uli Raich - 2017-09-07

Comments

I Attachment History Action Size Date Who Comment
PNGpng include-1.png r1 manage 5.2 K 2017-09-07 - 09:17 UnknownUser  
PNGpng include.png r1 manage 5.0 K 2017-09-07 - 09:17 UnknownUser  
PNGpng question.png r1 manage 16.6 K 2017-09-07 - 09:17 UnknownUser  
PNGpng questionRes.png r1 manage 8.1 K 2017-09-07 - 09:18 UnknownUser  
PNGpng structs.png r1 manage 29.3 K 2017-09-07 - 09:17 UnknownUser  
PNGpng switch-1.png r1 manage 23.2 K 2017-09-07 - 09:17 UnknownUser  
PNGpng switch-2.png r1 manage 33.6 K 2017-09-07 - 09:17 UnknownUser  

This topic: Embedded_Systems > WebHome > LectureSlides > Lecture3:IntroductionToCProgramming
Topic revision: r2 - 2017-09-07 - uli
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback