Skip to content
Snippets Groups Projects
Commit 628cf904 authored by Peter Gerwinski's avatar Peter Gerwinski
Browse files

Weitere Beispiele 17.10.2019

parent 4fe428c6
No related branches found
No related tags found
No related merge requests found
#include <stdio.h>
int main (void)
{
double pi;
pi = 3,1415;
printf ("pi = %lf\n", pi);
return 0;
}
#include <stdio.h>
int main (void)
{
double pi;
pi = (3,1415);
printf ("pi = %lf\n", pi);
return 0;
}
#include <stdio.h>
int main (void)
{
for (int i = 1; i < 10; printf ("%d\n", i), i++);
return 0;
}
#include <stdio.h>
int a, b = 3;
void foo (void)
{
b++;
static int a = 5;
int b = 7;
printf ("foo(): a = %d, b = %d\n", a, b);
a++;
}
int main (void)
{
printf ("main(): a = %d, b = %d\n", a, b);
/*
foo ();
printf ("main(): a = %d, b = %d\n", a, b);
a = b = 12;
printf ("main(): a = %d, b = %d\n", a, b);
foo ();
printf ("main(): a = %d, b = %d\n", a, b);
*/
return 0;
}
#include <stdio.h>
int a = 0, b = 3;
void foo (void)
{
b++;
static int a = 5;
int b = 7;
printf ("foo(): a = %d, b = %d\n", a, b);
a++;
}
int main (void)
{
printf ("main(): a = %d, b = %d\n", a, b);
/*
foo ();
printf ("main(): a = %d, b = %d\n", a, b);
a = b = 12;
printf ("main(): a = %d, b = %d\n", a, b);
foo ();
printf ("main(): a = %d, b = %d\n", a, b);
*/
return 0;
}
#include <stdio.h>
int a = 0, b = 3;
void foo (void)
{
b++;
static int a = 5;
int b = 7;
printf ("foo(): a = %d, b = %d\n", a, b);
a++;
}
int main (void)
{
printf ("main(): a = %d, b = %d\n", a, b);
foo ();
/*
printf ("main(): a = %d, b = %d\n", a, b);
a = b = 12;
printf ("main(): a = %d, b = %d\n", a, b);
foo ();
printf ("main(): a = %d, b = %d\n", a, b);
*/
return 0;
}
#include <stdio.h>
int a = 0, b = 3;
void foo (void)
{
b++;
static int a = 5;
int b = 7;
printf ("foo(): a = %d, b = %d\n", a, b);
a++;
}
int main (void)
{
printf ("main(): a = %d, b = %d\n", a, b);
foo ();
printf ("main(): a = %d, b = %d\n", a, b);
/*
a = b = 12;
printf ("main(): a = %d, b = %d\n", a, b);
foo ();
printf ("main(): a = %d, b = %d\n", a, b);
*/
return 0;
}
#include <stdio.h>
int a = 0, b = 3;
void foo (void)
{
b++;
static int a = 5;
int b = 7;
printf ("foo(): a = %d, b = %d\n", a, b);
a++;
}
int main (void)
{
printf ("main(): a = %d, b = %d\n", a, b);
foo ();
printf ("main(): a = %d, b = %d\n", a, b);
a = b = 12;
printf ("main(): a = %d, b = %d\n", a, b);
/*
foo ();
printf ("main(): a = %d, b = %d\n", a, b);
*/
return 0;
}
#include <stdio.h>
int a = 0, b = 3;
void foo (void)
{
b++;
static int a = 5;
int b = 7;
printf ("foo(): a = %d, b = %d\n", a, b);
a++;
}
int main (void)
{
printf ("main(): a = %d, b = %d\n", a, b);
foo ();
printf ("main(): a = %d, b = %d\n", a, b);
a, b = 12;
printf ("main(): a = %d, b = %d\n", a, b);
/*
foo ();
printf ("main(): a = %d, b = %d\n", a, b);
*/
return 0;
}
#include <stdio.h>
int a = 0, b = 3;
void foo (void)
{
b++;
static int a = 5;
int b = 7;
printf ("foo(): a = %d, b = %d\n", a, b);
a++;
}
int main (void)
{
printf ("main(): a = %d, b = %d\n", a, b);
foo ();
printf ("main(): a = %d, b = %d\n", a, b);
a = b = 12;
printf ("main(): a = %d, b = %d\n", a, b);
foo ();
/*
printf ("main(): a = %d, b = %d\n", a, b);
*/
return 0;
}
#include <stdio.h>
int a = 0, b = 3;
void foo (void)
{
b++;
static int a = 5;
int b = 7;
printf ("foo(): a = %d, b = %d\n", a, b);
a++;
}
int main (void)
{
printf ("main(): a = %d, b = %d\n", a, b);
foo ();
printf ("main(): a = %d, b = %d\n", a, b);
a = b = 12;
printf ("main(): a = %d, b = %d\n", a, b);
foo ();
printf ("main(): a = %d, b = %d\n", a, b);
return 0;
}
.file "functions-8.c"
.section .rodata.str1.1,"aMS",@progbits,1
.LC0:
.string "foo(): a = %d, b = %d\n"
.text
.globl foo
.type foo, @function
foo:
.LFB11:
.cfi_startproc
subq $8, %rsp
.cfi_def_cfa_offset 16
addl $1, b(%rip)
movl $7, %edx
movl a.2249(%rip), %esi
leaq .LC0(%rip), %rdi
movl $0, %eax
call printf@PLT
addl $1, a.2249(%rip)
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE11:
.size foo, .-foo
.section .rodata.str1.1
.LC1:
.string "main(): a = %d, b = %d\n"
.text
.globl main
.type main, @function
main:
.LFB12:
.cfi_startproc
subq $8, %rsp
.cfi_def_cfa_offset 16
movl b(%rip), %edx
movl a(%rip), %esi
leaq .LC1(%rip), %rdi
movl $0, %eax
call printf@PLT
call foo
movl b(%rip), %edx
movl a(%rip), %esi
leaq .LC1(%rip), %rdi
movl $0, %eax
call printf@PLT
movl $12, b(%rip)
movl $12, a(%rip)
movl $12, %edx
movl $12, %esi
leaq .LC1(%rip), %rdi
movl $0, %eax
call printf@PLT
call foo
movl b(%rip), %edx
movl a(%rip), %esi
leaq .LC1(%rip), %rdi
movl $0, %eax
call printf@PLT
movl $0, %eax
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE12:
.size main, .-main
.data
.align 4
.type a.2249, @object
.size a.2249, 4
a.2249:
.long 5
.globl b
.align 4
.type b, @object
.size b, 4
b:
.long 3
.globl a
.bss
.align 4
.type a, @object
.size a, 4
a:
.zero 4
.ident "GCC: (Debian 6.3.0-18+deb9u1) 6.3.0 20170516"
.section .note.GNU-stack,"",@progbits
No preview for this file type
...@@ -888,7 +888,7 @@ ...@@ -888,7 +888,7 @@
\item \item
{\only<2->{\color{red}}Zuweisung}: \lstinline{= += -= *= /= %=} {\only<2->{\color{red}}Zuweisung}: \lstinline{= += -= *= /= %=}
\item \item
Ignorieren: \lstinline{,} Ignorieren: \lstinline{,}\quad \lstinline{a, b}: berechne \lstinline{a}, ignoriere es, nimm stattdessen \lstinline{b}
\end{itemize} \end{itemize}
\pause \pause
\medskip \medskip
......
#include <stdio.h>
void main ()
{
printf ("Hello, world!\n");
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment