Úvod do jazyka C

Algorithm

a set of steps to accomplish a task




  printf



  printf();



  printf("Hello World");


int main(){
  printf("Hello World");
  return 0;
}
#include <stdio.h>

int main(){
  printf("Hello World");
  return 0;
}

source code

compiler

Otvor kapotu

Hoho

Vyber sviečku

Vlož novú sviečku

Zatvor kapotu

HohoHoho

HahOhi

HdsfhOhi

Ktorú sviečku?

Druhú

Interpreter

Python

Otvor kapotu

Hoho

Vyber sviečku

Vlož novú sviečku

Zatvor kapotu

HohoHoho

HahOhi

HdsfhOhi

Ktorú sviečku?

Compiler

C

Otvor kapotu

Hoho

Vyber druhú sviečku

Vlož novú sviečku

Zatvor kapotu

HohoHoho

HahOhi

HdsfhOhi

Compiler

C

Interpreter

Compiler

  • Runs slowly

  • Starts right away

  • Let you see results

  • Program runs quickly

  • Extra preparation time

JavaScript

Python

C

Swift

Pascal

Java

Interpreter

compiler

source code

object code

01011111 10110100 10111110 10100101 11011010 10010010 11011100 01001101
10111001 10011001 01111001 01100100 01111101 01101100 11110100 10010100
11111100 11000101 01110110 11011011 00110101 10111100 11110010 00101111
00100100 10110101 10000101 10011101 11100110 11011011 01010100 10110111
00001000 01011001 10111011 10101101 00100101 01001110 11111001 10110111
11011000 00001010 01001000 11100100 01101011 00101011 01011000 10110011
11110111 00111011 01100000 10101000 01111000 10001011 01001011 00010100
11101111 00101111 10110100 10100100 11100110 11101011 01101101 00001011

01011111 10110100 10111110 10100101 11011010 10010010 11011100 01001101
10111001 10011001 01111001 01100100 01111101 01101100 11110100 10010100
11111100 11000101 01110110 11011011 00110101 10111100 11110010 00101111
00100100 10110101 10000101 10011101 11100110 11011011 01010100 10110111
00001000 01011001 10111011 10101101 00100101 01001110 11111001 10110111
11011000 00001010 01001000 11100100 01101011 00101011 01011000 10110011
11110111 00111011 01100000 10101000 01111000 10001011 01001011 00010100
11101111 00101111 10110100 10100100 11100110 11101011 01101101 00001011

How to compile a program?

gcc -o helloworld helloworld.c
make helloworld.c

or

Windows

cygwin
mingw

OSX

xcode

Linux

coffee :)

How to install compiler?

./helloworld

How to run program?

September 9, 1947,

Houston, we have a BUG!

DRY

Don't Repeat Yourself

WET

Write Every Time

Function

sequence of program instructions that perform a specific task , packaged as a unit

ret_type name(params);

void

Definition
vs
Declaration

Questions?

Úvod do jazyka C

By tomaslorinc

Úvod do jazyka C

  • 434