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

Beispiele 4.4.2024

parent 80de45bc
Branches
No related tags found
No related merge requests found
#include <stdio.h>
int main (void)
{
char a[][5] = { "Dies", "ist", "ein", "Test", "" };
for (char **p = a; **p; p++)
printf ("%s\n", p);
return 0;
}
#include <stdio.h>
int main (void)
{
char a[][5] = { "Dies", "ist", "ein", "Test", "" };
for (char *p = a; *p; p++)
printf ("%s\n", p);
return 0;
}
#include <stdio.h>
int main (void)
{
char a[][5] = { "Dies", "ist", "ein", "Test", "" };
for (char *p = a; *p; p += 5)
printf ("%s\n", p);
return 0;
}
#include <stdio.h>
typedef char string5[5];
int main (void)
{
string5 a[] = { "Dies", "ist", "ein", "Test", "" };
for (string5 *p = a; *p; p++)
printf ("%s\n", *p);
return 0;
}
#include <stdio.h>
typedef char string5[5];
int main (void)
{
string5 a[] = { "Dies", "ist", "ein", "Test", "" };
for (string5 *p = a; *p; p++)
printf ("%s\n", p);
return 0;
}
#include <stdio.h>
typedef char string5[5];
int main (void)
{
string5 a[] = { "Dies", "ist", "ein", "Test", "" };
for (string5 *p = a; **p; p++)
printf ("%s\n", *p);
return 0;
}
#include <stdio.h>
typedef char string5[5];
int main (void)
{
string5 *p = { "Dies", "ist", "ein", "Test", "" };
while (**p)
printf ("%s\n", *p++);
return 0;
}
.file "arrays-and-pointers-21.c"
.text
.section .rodata
.LC0:
.string "Dies"
.string "ist" # manuell eingefügt
.string "ein" # manuell eingefügt
.string "Test" # manuell eingefügt
.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
subq $16, %rsp
leaq .LC0(%rip), %rax
movq %rax, -8(%rbp)
jmp .L2
.L3:
movq -8(%rbp), %rax
leaq 5(%rax), %rdx
movq %rdx, -8(%rbp)
movq %rax, %rdi
call puts@PLT
.L2:
movq -8(%rbp), %rax
movzbl (%rax), %eax
testb %al, %al
jne .L3
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
.file "arrays-and-pointers-21.c"
.text
.section .rodata
.LC0:
.string "Dies"
.string "ist\000" # manuell eingefügt
.string "ein\000" # manuell eingefügt
.string "Test" # manuell eingefügt
.string "" # manuell eingefügt
.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
subq $16, %rsp
leaq .LC0(%rip), %rax
movq %rax, -8(%rbp)
jmp .L2
.L3:
movq -8(%rbp), %rax
leaq 5(%rax), %rdx
movq %rdx, -8(%rbp)
movq %rax, %rdi
call puts@PLT
.L2:
movq -8(%rbp), %rax
movzbl (%rax), %eax
testb %al, %al
jne .L3
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment