Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • 2016ws
  • 2017ws
  • 2018ws
  • 2019ws
  • 2020ws
  • 2021ws
  • 2022ws
  • 2023ws
  • 2024ws
9 results

Target

Select target project
  • pgerwinski/hp
  • bwildenhain/hp
  • Daniel.Eisi/hp
  • aahrens/hp
4 results
Select Git revision
  • 2016ws
  • 2017ws
  • 2018ws
  • master
4 results
Show changes
Showing
with 0 additions and 381 deletions
#include <stdio.h>
int main (void)
{
int a = 3;
int b = 5;
printf ("%d\n", a += b);
printf ("%d\n", a);
printf ("%d\n", b);
return 0;
}
#include <stdio.h>
int main (void)
{
int a = 3;
int b = 5;
printf ("%d\n", a + b);
printf ("%d\n", a);
printf ("%d\n", b);
return 0;
}
#include <stdio.h>
int main (void)
{
int a = 3;
a = (3,14);
printf ("%d\n", a);
return 0;
}
#include <stdio.h>
int main (void)
{
int a = 137;
int b = 0;
if (b == 0)
printf ("Bitte nicht durch 0 teilen.\n");
printf ("So was macht man nicht.\n");
else
printf ("a / b = %d\n", a / b);
return 0;
}
#include <stdio.h>
int main (void)
{
int a = 137;
int b = 0;
if (b == 0)
printf ("Bitte nicht durch 0 teilen.\n"),
printf ("So was macht man nicht.\n");
else
printf ("a / b = %d\n", a / b);
return 0;
}
#include <stdio.h>
int main (void)
{
int pflll[8] = { 1, 2, 3, 4, 5, 6, 7, 8 };
int prime[8] = { 2, 3, 5, 7, 11, 13, 17, 19 };
printf ("prime:\n");
for (int *p = prime; *p; p++)
printf ("%d\n", *p);
printf ("pflll:\n");
for (int *q = pflll; *q; q++)
printf ("%d\n", *q);
return 0;
}
#include <stdio.h>
#include <errno.h>
#include <string.h>
int main (void)
{
FILE *f = fopen ("fhello.txt", "w");
if (f)
{
fprintf (f, "Hello, world!\n");
fclose (f);
return 0;
}
else
{
char *msg = strerror (errno);
fprintf (stderr, "Fehler: %s\n", msg);
return errno;
}
}
cassini/home/peter/bo/2023ws/hp/20231019> gcc -Wall -O files-07.c -o files-07
cassini/home/peter/bo/2023ws/hp/20231019> ./files-07
Fehler: Permission denied
cassini/home/peter/bo/2023ws/hp/20231019> echo $?
13
cassini/home/peter/bo/2023ws/hp/20231019> rm fhello.txt
rm: reguläre Datei (schreibgeschützt) 'fhello.txt' entfernen? y
cassini/home/peter/bo/2023ws/hp/20231019> ./files-07
cassini/home/peter/bo/2023ws/hp/20231019> echo $?
0
cassini/home/peter/bo/2023ws/hp/20231019> ls -l fhello.txt
-rw-r--r-- 1 peter peter 14 19. Okt 15:56 fhello.txt
cassini/home/peter/bo/2023ws/hp/20231019> chmod -w fhello.txt
cassini/home/peter/bo/2023ws/hp/20231019> ls -l fhello.txt
-r--r--r-- 1 peter peter 14 19. Okt 15:56 fhello.txt
cassini/home/peter/bo/2023ws/hp/20231019> ./files-07
Fehler: Permission denied
cassini/home/peter/bo/2023ws/hp/20231019> echo $?
13
cassini/home/peter/bo/2023ws/hp/20231019>
File deleted
#include <stdio.h>
#include <string.h>
int main (void)
{
char hello[] = "Hello, world!\n";
printf ("%s\n", hello);
printf ("%zd\n", strlen (hello));
printf ("%s\n", hello + 17);
printf ("%zd\n", strlen (hello + 17));
return 0;
hello[5] = 0;
printf ("%s\n", hello);
printf ("%zd\n", strlen (hello));
return 0;
}
File deleted
File deleted
.file "string-ops-03.c"
.text
.section .rodata
.LC0:
.string "Zacharias"
.LC1:
.string "Anton"
.LC2:
.string "%d\n"
.text
.globl main
.type main, @function
main:
.LFB0:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
addq $-128, %rsp
leaq .LC0(%rip), %rax
movq %rax, -8(%rbp)
leaq .LC1(%rip), %rax
movq %rax, -16(%rbp)
movq -16(%rbp), %rax
cmpq -8(%rbp), %rax
setb %al
movzbl %al, %eax
movl %eax, %esi
leaq .LC2(%rip), %rax
movq %rax, %rdi
movl $0, %eax
call printf@PLT
movq -8(%rbp), %rax
cmpq -16(%rbp), %rax
setb %al
movzbl %al, %eax
movl %eax, %esi
leaq .LC2(%rip), %rax
movq %rax, %rdi
movl $0, %eax
call printf@PLT
movl $1, %esi
leaq .LC2(%rip), %rax
movq %rax, %rdi
movl $0, %eax
call printf@PLT
movl $0, %eax
leave
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE0:
.size main, .-main
.ident "GCC: (Debian 12.2.0-14) 12.2.0"
.section .note.GNU-stack,"",@progbits
#include <stdio.h>
#include <string.h>
int main (void)
{
char *zacharias = "Zacha";
char *anton = "Anton";
printf ("%d\n", strcmp (anton, zacharias));
printf ("%d\n", strcmp (zacharias, anton));
printf ("%d\n", strcmp (anton, anton));
char buffer[100] = "Huber ";
strcat (buffer, anton);
printf ("%s\n", buffer);
return 0;
}
#include <stdio.h>
#include <string.h>
int main (void)
{
char *zacharias = "Zacha";
char *anton = "Anton";
printf ("%d\n", strcmp (anton, zacharias));
printf ("%d\n", strcmp (zacharias, anton));
printf ("%d\n", strcmp (anton, anton));
char buffer[] = "Huber ";
strcat (buffer, anton);
printf ("%s\n", buffer);
printf ("%s\n", anton);
return 0;
}
#include <stdio.h>
#include <string.h>
int main (void)
{
char *zacharias = "Zacha";
char *anton = "Anton";
printf ("%d\n", strcmp (anton, zacharias));
printf ("%d\n", strcmp (zacharias, anton));
printf ("%d\n", strcmp (anton, anton));
char buffer[] = "Huber ";
strcat (buffer, "Antonius, genannt Toni oder Anton");
printf ("%s\n", buffer);
printf ("%s\n", anton);
return 0;
}
#include <stdio.h>
#include <string.h>
int main (void)
{
char *zacharias = "Zacha";
char *anton = "Anton";
char *toni = "Antonius, genannt Toni oder Anton";
printf ("%d\n", strcmp (anton, zacharias));
printf ("%d\n", strcmp (zacharias, anton));
printf ("%d\n", strcmp (anton, anton));
char buffer[] = "Huber ";
strcat (buffer, toni);
printf ("%s\n", buffer);
printf ("%s\n", anton);
return 0;
}
#include <stdio.h>
#include <string.h>
int main (void)
{
char *zacharias = "Zacha";
char *anton = "Anton";
char *toni = "Antonius!!";
printf ("%d\n", strcmp (anton, zacharias));
printf ("%d\n", strcmp (zacharias, anton));
printf ("%d\n", strcmp (anton, anton));
char buffer[] = "Huber ";
strcat (buffer, toni);
printf ("%s\n", buffer);
printf ("%s\n", anton);
return 0;
}
#include <stdio.h>
#include <string.h>
int main (void)
{
char *zacharias = "Zacha";
char *anton = "Anton";
char *toni = "Antonius!";
printf ("%d\n", strcmp (anton, zacharias));
printf ("%d\n", strcmp (zacharias, anton));
printf ("%d\n", strcmp (anton, anton));
char buffer[] = "Huber ";
strcat (buffer, toni);
printf ("%s\n", buffer);
printf ("%s\n", anton);
return 0;
}
.file "string-ops-11.c"
.text
.section .rodata.str1.1,"aMS",@progbits,1
.LC0:
.string "%d\n"
.LC1:
.string "Anton"
.text
.globl main
.type main, @function
main:
.LFB11:
.cfi_startproc
pushq %rbx
.cfi_def_cfa_offset 16
.cfi_offset 3, -16
subq $16, %rsp
.cfi_def_cfa_offset 32
movl $-1, %esi
leaq .LC0(%rip), %rbx
movq %rbx, %rdi
movl $0, %eax
call printf@PLT
movl $1, %esi ; #include <stdio.h>
movq %rbx, %rdi ; #include <string.h>
movl $0, %eax ;
call printf@PLT ; int main (void)
movl $0, %esi ; {
movq %rbx, %rdi ; char *zacharias = "Zacha";
movl $0, %eax ; char *anton = "Anton";
call printf@PLT ; char *toni = "Antonius!";
movl $1700951368, 9(%rsp) ;
movl $2126437, 12(%rsp) ; printf ("%d\n", strcmp (anton, zacharias));
leaq 9(%rsp), %rbx ; printf ("%d\n", strcmp (zacharias, anton));
movq %rbx, %rdi ; printf ("%d\n", strcmp (anton, anton));
call strlen@PLT ;
addq %rbx, %rax ; char buffer[] = "Huber ";
movabsq $8319671809674079809, %rdx ; strcat (buffer, toni);
movq %rdx, (%rax) ; printf ("%s\n", buffer);
movw $33, 8(%rax) ; printf ("%s\n", anton);
movq %rbx, %rdi ;
call puts@PLT ; return 0;
leaq .LC1(%rip), %rdi ; }
call puts@PLT
movl $0, %eax
addq $16, %rsp
.cfi_def_cfa_offset 16
popq %rbx
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE11:
.size main, .-main
.ident "GCC: (Debian 12.2.0-14) 12.2.0"
.section .note.GNU-stack,"",@progbits
#include <stdio.h>
#include <string.h>
int main (void)
{
char *zacharias = "Zacha";
char *anton = "Anton";
char *toni = "Toni";
printf ("%d\n", strcmp (anton, zacharias));
printf ("%d\n", strcmp (zacharias, anton));
printf ("%d\n", strcmp (anton, anton));
char buffer[] = "Huber ";
strcat (buffer, toni);
printf ("%s\n", buffer);
printf ("%s\n", anton);
return 0;
}