Compare commits
6 Commits
main
...
Aufg1-dev-
| Author | SHA1 | Date | |
|---|---|---|---|
| 5d78ae3349 | |||
| 5fa8a68108 | |||
| 08d8778929 | |||
| 762dd4df86 | |||
| 382203559c | |||
| c8490df248 |
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
1_Grundlagen/code/matrix.exe
|
||||||
28
.vscode/tasks.json
vendored
Normal file
28
.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"type": "cppbuild",
|
||||||
|
"label": "C/C++: x86_64-w64-mingw32-gcc.exe build active file",
|
||||||
|
"command": "c:\\Users\\tobis\\mingw64\\bin\\x86_64-w64-mingw32-gcc.exe",
|
||||||
|
"args": [
|
||||||
|
"-fdiagnostics-color=always",
|
||||||
|
"-g",
|
||||||
|
"${file}",
|
||||||
|
"-o",
|
||||||
|
"${fileDirname}\\${fileBasenameNoExtension}.exe"
|
||||||
|
],
|
||||||
|
"options": {
|
||||||
|
"cwd": "c:\\Users\\tobis\\mingw64\\bin"
|
||||||
|
},
|
||||||
|
"problemMatcher": [
|
||||||
|
"$gcc"
|
||||||
|
],
|
||||||
|
"group": {
|
||||||
|
"kind": "build",
|
||||||
|
"isDefault": true
|
||||||
|
},
|
||||||
|
"detail": "Task generated by Debugger."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"version": "2.0.0"
|
||||||
|
}
|
||||||
15
1_Grundlagen/Vorbereitungsaufgaben/Speicheradressen.typ
Normal file
15
1_Grundlagen/Vorbereitungsaufgaben/Speicheradressen.typ
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#table(
|
||||||
|
columns: (1fr, auto, auto),
|
||||||
|
inset: 10pt,
|
||||||
|
align: horizon,
|
||||||
|
table.header(
|
||||||
|
[*Adresse*], [*Inhalt an der Adresse*], [Name der Variablen],
|
||||||
|
),
|
||||||
|
`0x7fffffffd7d8`,
|
||||||
|
\&int\*\*,
|
||||||
|
matrix,
|
||||||
|
`0x7fffffffd938`,
|
||||||
|
\&uadf,
|
||||||
|
matrix[0]
|
||||||
|
)
|
||||||
|
|
||||||
5
1_Grundlagen/Vorbereitungsaufgaben/comilerfehler.cpp
Normal file
5
1_Grundlagen/Vorbereitungsaufgaben/comilerfehler.cpp
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
std::cout << "Hello, World!";
|
||||||
|
|
||||||
BIN
1_Grundlagen/Vorbereitungsaufgaben/laufzeit
Executable file
BIN
1_Grundlagen/Vorbereitungsaufgaben/laufzeit
Executable file
Binary file not shown.
8
1_Grundlagen/Vorbereitungsaufgaben/laufzeitfehler.cpp
Normal file
8
1_Grundlagen/Vorbereitungsaufgaben/laufzeitfehler.cpp
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#include <iostream>
|
||||||
|
using namespace std;
|
||||||
|
int main(){
|
||||||
|
int array[3] = {0, 1, 2};
|
||||||
|
for (int i = 0; i < 10; i++){
|
||||||
|
cout << array[i] << "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
48
1_Grundlagen/Vorbereitungsaufgaben/laufzeitfehler.s
Normal file
48
1_Grundlagen/Vorbereitungsaufgaben/laufzeitfehler.s
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
.file "laufzeitfehler.cpp"
|
||||||
|
.text
|
||||||
|
#APP
|
||||||
|
.globl _ZSt21ios_base_library_initv
|
||||||
|
.section .rodata
|
||||||
|
.LC0:
|
||||||
|
.string "\n"
|
||||||
|
#NO_APP
|
||||||
|
.text
|
||||||
|
.globl main
|
||||||
|
.type main, @function
|
||||||
|
main:
|
||||||
|
.LFB1984:
|
||||||
|
.cfi_startproc
|
||||||
|
pushq %rbp
|
||||||
|
.cfi_def_cfa_offset 16
|
||||||
|
.cfi_offset 6, -16
|
||||||
|
movq %rsp, %rbp
|
||||||
|
.cfi_def_cfa_register 6
|
||||||
|
subq $16, %rsp
|
||||||
|
movl $0, -16(%rbp)
|
||||||
|
movl $1, -12(%rbp)
|
||||||
|
movl $2, -8(%rbp)
|
||||||
|
movl $0, -4(%rbp)
|
||||||
|
jmp .L2
|
||||||
|
.L3:
|
||||||
|
movl -4(%rbp), %eax
|
||||||
|
cltq
|
||||||
|
movl -16(%rbp,%rax,4), %eax
|
||||||
|
movl %eax, %esi
|
||||||
|
movl $_ZSt4cout, %edi
|
||||||
|
call _ZNSolsEi
|
||||||
|
movl $.LC0, %esi
|
||||||
|
movq %rax, %rdi
|
||||||
|
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
|
||||||
|
addl $1, -4(%rbp)
|
||||||
|
.L2:
|
||||||
|
cmpl $9, -4(%rbp)
|
||||||
|
jle .L3
|
||||||
|
movl $0, %eax
|
||||||
|
leave
|
||||||
|
.cfi_def_cfa 7, 8
|
||||||
|
ret
|
||||||
|
.cfi_endproc
|
||||||
|
.LFE1984:
|
||||||
|
.size main, .-main
|
||||||
|
.ident "GCC: (GNU) 15.2.1 20260123 (Red Hat 15.2.1-7)"
|
||||||
|
.section .note.GNU-stack,"",@progbits
|
||||||
3
1_Grundlagen/Vorbereitungsaufgaben/linker.h
Normal file
3
1_Grundlagen/Vorbereitungsaufgaben/linker.h
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
|
||||||
|
int addtwo(int s1, int s2)
|
||||||
|
{}
|
||||||
9
1_Grundlagen/Vorbereitungsaufgaben/linkerfehler.cpp
Normal file
9
1_Grundlagen/Vorbereitungsaufgaben/linkerfehler.cpp
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
|
||||||
|
void addtwo();
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
int a = 1;
|
||||||
|
int b = 2;
|
||||||
|
addtwo();
|
||||||
|
}
|
||||||
|
|
||||||
5
1_Grundlagen/Vorbereitungsaufgaben/linkerfehler2.cpp
Normal file
5
1_Grundlagen/Vorbereitungsaufgaben/linkerfehler2.cpp
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#include <link.h>
|
||||||
|
|
||||||
|
int add(int s1, int s2){
|
||||||
|
return s1 + s2;
|
||||||
|
}
|
||||||
10
1_Grundlagen/Vorbereitungsaufgaben/praeprozessorfehler.cpp
Normal file
10
1_Grundlagen/Vorbereitungsaufgaben/praeprozessorfehler.cpp
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#include <iostream>
|
||||||
|
#define NUM 0
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
int i;
|
||||||
|
i = NUM;
|
||||||
|
cout << i << "\n" ;
|
||||||
|
}
|
||||||
|
|
||||||
3
1_Grundlagen/Vorbereitungsaufgaben/praeprozessorfehler.h
Normal file
3
1_Grundlagen/Vorbereitungsaufgaben/praeprozessorfehler.h
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#define NUM
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 105 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 45 KiB |
BIN
1_Grundlagen/code/a.out
Executable file
BIN
1_Grundlagen/code/a.out
Executable file
Binary file not shown.
BIN
1_Grundlagen/code/coolesProgram
Executable file
BIN
1_Grundlagen/code/coolesProgram
Executable file
Binary file not shown.
BIN
1_Grundlagen/code/core.12622
Normal file
BIN
1_Grundlagen/code/core.12622
Normal file
Binary file not shown.
BIN
1_Grundlagen/code/core.12629
Normal file
BIN
1_Grundlagen/code/core.12629
Normal file
Binary file not shown.
BIN
1_Grundlagen/code/core.14236
Normal file
BIN
1_Grundlagen/code/core.14236
Normal file
Binary file not shown.
BIN
1_Grundlagen/code/matrix
Executable file
BIN
1_Grundlagen/code/matrix
Executable file
Binary file not shown.
@ -1,34 +1,49 @@
|
|||||||
#include<stdio.h>
|
#include <stdio.h>
|
||||||
#include<stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include "matrix.h"
|
||||||
|
|
||||||
int main()
|
int ***build_matrix(int nx, int ny, int nz)
|
||||||
{
|
{
|
||||||
const int nx=3;
|
int ***matrix = (int ***)malloc(nz * sizeof(int **));
|
||||||
const int ny=2;
|
for (int z = 0; z < nz; z++)
|
||||||
int** matrix;
|
|
||||||
|
|
||||||
matrix = (int**)malloc(ny*sizeof(int*));
|
|
||||||
for(int y=0; y<ny; y++)
|
|
||||||
{
|
{
|
||||||
matrix[y] = (int*)malloc(nx*sizeof(int));
|
matrix[z] = (int **)malloc(ny * sizeof(int *));
|
||||||
for(int x=0; x<nx; x++)
|
for (int y = 0; y < ny; y++)
|
||||||
{
|
{
|
||||||
matrix[y][x] = (y+1)*10 + x+1;
|
matrix[z][y] = (int *)malloc(nx * sizeof(int));
|
||||||
|
for (int x = 0; x < nx; x++)
|
||||||
|
{
|
||||||
|
matrix[z][y][x] = (z + 1) * 100 + (y + 1) * 10 + x + 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return matrix;
|
||||||
|
}
|
||||||
|
|
||||||
for(int y=0; y<ny; y++)
|
void print_matrix(int ***matrix, int nx, int ny, int nz)
|
||||||
|
{
|
||||||
|
for (int z = 0; z < nz; z++)
|
||||||
{
|
{
|
||||||
for(int x=0; x<nx; x++)
|
for (int y = 0; y < ny; y++)
|
||||||
{
|
{
|
||||||
printf("%i ",matrix[y][x]);
|
for (int x = 0; x < nx; x++)
|
||||||
|
{
|
||||||
|
printf("%i ", matrix[z][y][x]);
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
}
|
}
|
||||||
printf("\n");
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for(int y=0; y<ny; y++)
|
void free_matrix(int ***matrix, int ny, int nz)
|
||||||
|
{
|
||||||
|
for (int z = 0; z < nz; z++)
|
||||||
{
|
{
|
||||||
free(matrix[y]);
|
for (int y = 0; y < ny; y++)
|
||||||
|
{
|
||||||
|
free(matrix[z][y]);
|
||||||
|
}
|
||||||
|
free(matrix[z]);
|
||||||
}
|
}
|
||||||
free(matrix);
|
free(matrix);
|
||||||
}
|
}
|
||||||
6
1_Grundlagen/code/matrix.h
Normal file
6
1_Grundlagen/code/matrix.h
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
|
int ***build_matrix(int nx, int ny, int nz);
|
||||||
|
void print_matrix(int ***matrix, int nx, int ny, int nz);
|
||||||
|
void free_matrix(int ***matrix, int ny, int nz);
|
||||||
BIN
1_Grundlagen/code/matrix1
Executable file
BIN
1_Grundlagen/code/matrix1
Executable file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user