Compare commits
No commits in common. "9e94f7cbccfd999c8b1b92e61a854d95b0406e2c" and "23529ffe037eb365656687af411c1020a5aea556" have entirely different histories.
9e94f7cbcc
...
23529ffe03
9 changed files with 37 additions and 161 deletions
|
|
@ -4,6 +4,7 @@
|
|||
{% include "src/_includes/partials/header.njk" %}
|
||||
|
||||
<body>
|
||||
<section class="section">
|
||||
{% include "src/_includes/partials/darktoggle.njk" %}
|
||||
|
||||
{% include "src/_includes/partials/nav.njk"%}
|
||||
|
|
@ -13,5 +14,6 @@
|
|||
</div>
|
||||
|
||||
{% include "src/_includes/partials/footer.njk" %}
|
||||
</section>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
---
|
||||
layout: "base.njk"
|
||||
---
|
||||
<div class="main">
|
||||
<main>
|
||||
<h1 class="hero-title">
|
||||
{{ title | safe }}
|
||||
{{ title }}
|
||||
</h1>
|
||||
|
||||
<div class="page-content">
|
||||
|
|
@ -18,6 +18,6 @@ layout: "base.njk"
|
|||
{%- endfor -%}
|
||||
</ul>
|
||||
#}
|
||||
</div>
|
||||
</main>
|
||||
|
||||
{% include "src/_includes/partials/blob.html" %}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
layout: "base.njk"
|
||||
---
|
||||
<div class="main">
|
||||
<main>
|
||||
<h1 class="hero-title">
|
||||
{{ title }}
|
||||
</h1>
|
||||
|
|
@ -11,4 +11,4 @@ layout: "base.njk"
|
|||
<div class="page-content">
|
||||
{{ content | safe }}
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
|
@ -9,6 +9,7 @@
|
|||
</script>
|
||||
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{{ title }}</title>
|
||||
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="{{ "/css/main.css" | url }}">
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -24,7 +24,7 @@ a {
|
|||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.hero a {
|
||||
main a {
|
||||
font-family: "Righteous";
|
||||
text-decoration: underline;
|
||||
color: #910c75;
|
||||
|
|
@ -312,13 +312,12 @@ a.card-link {
|
|||
header {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
margin-bottom: 10vh;
|
||||
font-family: "Righteous";
|
||||
font-size: 1.3em;
|
||||
font-size: 20px;
|
||||
margin-top: 2em;
|
||||
}
|
||||
|
||||
|
|
@ -337,8 +336,6 @@ nav {
|
|||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
font-size: 1.3em;
|
||||
|
||||
gap: 3em;
|
||||
background: linear-gradient(to right, #151515 1px, transparent 1px) 0 0,
|
||||
linear-gradient(to right, #151515 1px, transparent 1px) 0 100%,
|
||||
|
|
@ -353,17 +350,17 @@ nav {
|
|||
}
|
||||
|
||||
.hero-title {
|
||||
line-break: anywhere;
|
||||
margin-top: 10vh;
|
||||
font-size: 3.5em;
|
||||
font-size: 5em;
|
||||
}
|
||||
|
||||
.page-content {
|
||||
font-size: 20px;
|
||||
margin: 0 20px;
|
||||
}
|
||||
|
||||
.main {
|
||||
max-width: 100%;
|
||||
main {
|
||||
max-width: 75em;
|
||||
align-self: center;
|
||||
}
|
||||
|
||||
|
|
@ -372,7 +369,7 @@ nav {
|
|||
}
|
||||
|
||||
p {
|
||||
max-width: 55vw;
|
||||
max-width: 45vw;
|
||||
}
|
||||
|
||||
.link {
|
||||
|
|
@ -456,7 +453,6 @@ transition: opacity 0.3s ease;
|
|||
background-color: hsl(220, 13%, 18%);
|
||||
color: hsl(220, 14%, 71%);
|
||||
border-radius: 0.3em;
|
||||
font-size: 1.3em;
|
||||
white-space: nowrap; /* prevent line breaks in inline code */
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,34 +0,0 @@
|
|||
---
|
||||
title: "How-To: Hausaufgaben"
|
||||
layout: "blog-post.njk"
|
||||
date: 2025-05-05
|
||||
---
|
||||
Der Ablauf der Bearbeitung einer Aufgabe am Beispiel "Aufgabe 0 - epoche"
|
||||
|
||||
1. Aufgaben-Repository erstellen (muss im cip ausgeführt werden)
|
||||
```sh
|
||||
/proj/i4sp1/bin/mkrepo epoche
|
||||
```
|
||||
Das Repo ist dann im [Gitlab](https://gitlab.cs.fau.de/) der FAU zu finden zu funden
|
||||
|
||||
2. Das Repo clonen (lokal herunterladen). Die URL findet ihr unter dem blauen "Code" button auf dem Repo in Gitlab.
|
||||
```sh
|
||||
git clone [REPO-URL]
|
||||
```
|
||||
|
||||
3. Lokale Änderungen durchführen
|
||||
|
||||
4. Die Änderungen und neuen Dateien dem lokalen commiten
|
||||
```sh
|
||||
git add . # Änderungen in den Staging bereich schieben
|
||||
git commit -m "[COMMIT_MESSAGE]" # Die Änderungen mit einem deskriptiven kommentar zu einem commit zusammenfasssen
|
||||
```
|
||||
|
||||
5. Alle commmits zu dem FAU Gitlab pushen (**SEHR WICHTIG**). Es kann nur bewertet werden, was vor der deadline gepushed wurde
|
||||
```sh
|
||||
git push
|
||||
```
|
||||
möglicherweise funktioniert das nicht auf anhieb und es muss einmal folgender command ausgeführt werden:
|
||||
```sh
|
||||
git push --set-upstream origin main
|
||||
```
|
||||
|
|
@ -4,15 +4,14 @@ layout: blog-page.njk
|
|||
page_for: "sp1-lesson"
|
||||
---
|
||||
## Meine Übungen
|
||||
- Tafelübung (T02) Montags 14:15 - 15:45 im [Seminarraum 0.031-113 (Aquarium)](https://www.campo.fau.de:443/qisserver/pages/startFlow.xhtml?_flowId=showRoomDetail-flow&roomId=788&roomType=3&context=showRoomDetail&navigationPosition=organisation,searchroom)
|
||||
- Tafelübung (T02) Montags 14:15 - 15:45 im [Seminarraum 0.031-113](https://www.campo.fau.de:443/qisserver/pages/startFlow.xhtml?_flowId=showRoomDetail-flow&roomId=788&roomType=3&context=showRoomDetail&navigationPosition=organisation,searchroom)
|
||||
- Rechnerübung Donnerstags 16:15 - 18:45 im [CIP1](https://www.campo.fau.de/qisserver/pages/startFlow.xhtml?_flowId=showRoomDetail-flow&roomId=3349&roomType=3&context=showRoomDetail&navigationPosition=organisation,searchroom)
|
||||
|
||||
## Wichtige Infos
|
||||
- <a href="./hausaufgaben">How-To: Hausaufgaben</a>
|
||||
- Unter `/proj/i4sp1/bin/` im CIP finden sich nützliche SP1-related Programme und scripts, wie
|
||||
- `mkrepo` zum Aufgaben-Repo erstellen
|
||||
- `deadline` zum Abgabetermine nachschauen
|
||||
- Vorgegebene Compiler-Flags: `-std=c11` `-pedantic` `-D_XOPEN_SOURCE=700` `-Wall` `-Werror` `-fsanitize=undefined` `-fno-sanitize-recover` `-g`
|
||||
- Vorgegebene Compiler-Flags: `-std=c11 -pedantic -D_XOPEN_SOURCE=700 -Wall -Werror -fsanitize=undefined -fno-sanitize-recover -g`
|
||||
|
||||
## Wichtige Links
|
||||
- [Aufgaben](https://sys.cs.fau.de/lehre/ss25/sp1/uebung#aufgaben)
|
||||
|
|
@ -34,13 +33,8 @@ page_for: "sp1-lesson"
|
|||
- Mail an mich: <a href="mailto:nova.ruff@fau.de" class="link">nova.ruff@fau.de</a>
|
||||
- [SP-FAQ](https://sys.cs.fau.de/lehre/ss25/sp1/faq)
|
||||
|
||||
## Andere Tutoren
|
||||
- [SP1 Website](https://sys.cs.fau.de/lehre/ss25/sp1)
|
||||
- [Lukas (T03)](https://wwwcip.cs.fau.de/~uk16isyq/)
|
||||
- [Julian (T08)](https://jzbor.de/tut/sp1/)
|
||||
- [Stefan (T09)](https://wwwcip.cs.fau.de/~ok73ozus/sp)
|
||||
- [Luca (T11)](https://wwwcip.cs.fau.de/~am99ihig/sp)
|
||||
- [Philip (ehemalig)](https://wwwcip.cs.fau.de/~oj14ozun/sp1/)
|
||||
|
||||
## Hilfreiche Links
|
||||
- [cdecl.org](https://cdecl.org/) um zu entziffern, was bei Pointern passiert
|
||||
## Weitere Links
|
||||
- [SP1 Website](https://sys.cs.fau.de/lehre/ss25/sp1)
|
||||
- [Julian (T08)](https://jzbor.de/tut/sp1/)
|
||||
- [Philip (ehemalig)](https://wwwcip.cs.fau.de/~oj14ozun/sp1/)
|
||||
|
|
|
|||
|
|
@ -7,8 +7,6 @@ date: 2025-05-04
|
|||
## Manual-Pages
|
||||
Mit dem Programm `man` kann die Dokumentation von verschiedenen Bibliotheksfunktionen nachgelesen werden: `man 3p printf`
|
||||
|
||||
Oft findet ihr die schreibweise `time(3p)`, d.h. es wird auf die manpage von time aus der section 3p verwiesen: `man 3p time`
|
||||
|
||||
## Workflow mit git
|
||||
- `git clone [URL]` - Remote Repo lokal herunterladen
|
||||
- `git pull` - Neuester Stand eines Repos herunterladen
|
||||
|
|
@ -18,83 +16,23 @@ Oft findet ihr die schreibweise `time(3p)`, d.h. es wird auf die manpage von tim
|
|||
- `git commit -m "[COMMMIT_MESSAGE]"` - Änderungen zu dem Repo committen
|
||||
- `git push` - Neue Commits an das remote Repo kommunizieren (**wichtig zur Übungsabgabe**)
|
||||
|
||||
## Die C Programmiersprache
|
||||
- Die "main" funktion in C bekommt immer 2 argumente:
|
||||
- `int argc`: enthält 1 + die Anzahl der Argumente, die dem Program gegeben wurden
|
||||
- `char *argv[]`: ein array von char-pointern (also ein char-pointer-pointer)
|
||||
- Das ende von char-arrays (string) wird mit dem Zeichen `'\0'` gekennzeichnet
|
||||
- Array-Zugriff: `arr[1]` ist gleichbedeutend mit `*(arr + 1)`
|
||||
- Struct-Zugriff: `myStruct->value` ist gleichbedeutend mit `(*myStruct).value`
|
||||
- <a href="{{ "/assets/Pointer-Diagramm.pdf" | url }}">Nützliches Pointer Diagramm</a>
|
||||
|
||||
## Fehlerbehandlung (wichtig)
|
||||
Funktionen können in C fehlschlagen und fehler müssen **immer** abgefangen und behandelt werden (außer in einer bereits laufenden Fehlerbehandlung).
|
||||
|
||||
Was der Rückgabewert einer Funktion ist, wenn sie fehlschlägt, steht in dem "RETURN VALUE" Abschnitt der zugehörigen manpage.
|
||||
z.B. steht in malloc(3p), dass im Fehlerfall ein "null pointer" returned wird; Wir müssen uns also nach jedem malloc-Aufruf versichern, dass der Rückgabewert nicht ein null pointer war:
|
||||
```c
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
// wir wollen 5 ints abspeichern
|
||||
int *p = malloc(sizeof(int) * 5);
|
||||
if (p == NULL) {
|
||||
// es gab einen fehler
|
||||
return -1;
|
||||
}
|
||||
// kein fehler -> es kann weitergemacht werden ...
|
||||
}
|
||||
```
|
||||
|
||||
## malloc und free
|
||||
Wichtig ist, dass mit `malloc` allokierter speicher auch wieder manuell mit der Funktion `free()` freigegeben werden **muss** (`free()` kann nicht fehlschlagen und benötigt so auch keine Fehlerbehandlung):
|
||||
```c
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
int *p = malloc(sizeof(int) * 5);
|
||||
if (p == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// ... do something with p ...
|
||||
|
||||
free(p);
|
||||
}
|
||||
```
|
||||
|
||||
## Beispiel Programme aus der Präsenzübung
|
||||
### Alle dem Program gegebenen Argumente drucken
|
||||
## Beispiel Program aus der Präsenzübung
|
||||
```c
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
// iterate over arguments passed to program
|
||||
// using strlen()
|
||||
for (int i = 1; i < argc; i++) {
|
||||
// get reference to char-array for given argument
|
||||
char *curr_arg = argv[i];
|
||||
|
||||
// alternative schreibweise:
|
||||
// char *curr_arg = *(argv + i);
|
||||
|
||||
printf("%s\n", curr_arg);
|
||||
for (int l = 0; l < strlen(curr_arg); l++) {
|
||||
printf("%c\n", curr_arg[l]);
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Jeden char der Argumente auf eine eigene Zeile drucken
|
||||
Bei diesem Program wurde benutzt, dass in C, char-arrays mit einem '\0'-byte terminiert sind
|
||||
```c
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
// iterate over arguments passed to program
|
||||
// start at i = 1, because i = 0 is the name of the program
|
||||
// alternative
|
||||
for (int i = 1; i < argc; i++) {
|
||||
// get reference to char-array for given argument
|
||||
char *curr_arg = argv[i];
|
||||
|
||||
// iterate over the current argument, until '\0' is reached (end of string)
|
||||
int l = 0;
|
||||
while (curr_arg[l] != '\0') {
|
||||
printf("%c\n", curr_arg[l]);
|
||||
|
|
@ -103,24 +41,3 @@ int main(int argc, char *argv[]) {
|
|||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Speicher für structs anlegen
|
||||
```c
|
||||
#include <stdio.h>
|
||||
|
||||
struct listelement {
|
||||
int value;
|
||||
struct listelement *next;
|
||||
};
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
struct listelement *element1 = malloc(sizeof(struct listelement));
|
||||
if (element1 == NULL) {
|
||||
// fehlerbehandlung ...
|
||||
}
|
||||
|
||||
// ... rest vom program
|
||||
|
||||
free(element1)
|
||||
}
|
||||
```
|
||||
Loading…
Add table
Reference in a new issue