aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeonard Kugis <leonardkugis@gmail.com>2018-01-13 17:17:31 +0100
committerLeonard Kugis <leonardkugis@gmail.com>2018-01-13 17:17:31 +0100
commit78109333d989fa678c3c864defc4ef9d170f58ce (patch)
treec31e0f73a272ea023a67e78f904642531e57bc50
parentd4c120217549f928a01ef5a69b3760851e1fda8d (diff)
Initial commit
-rw-r--r--.gitignore48
-rw-r--r--Makefile14
-rw-r--r--defs.h16
-rw-r--r--main.c34
-rw-r--r--main.h25
5 files changed, 55 insertions, 82 deletions
diff --git a/.gitignore b/.gitignore
index c4be1f7..2dfcb34 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,24 +1,24 @@
-*.com
-*.class
-*.dll
-*.exe
-*.o
-*.so
-*.7z
-*.dmg
-*.gz
-*.iso
-*.jar
-*.rar
-*.tar
-*.zip
-*.log
-*.sql
-*.sqlite
-.DS_Store
-.DS_Store?
-._*
-.Spotlight-V100
-.Trashes
-ehthumbs.db
-Thumbs.db
+*.com
+*.class
+*.dll
+*.exe
+*.o
+*.so
+*.7z
+*.dmg
+*.gz
+*.iso
+*.jar
+*.rar
+*.tar
+*.zip
+*.log
+*.sql
+*.sqlite
+.DS_Store
+.DS_Store?
+._*
+.Spotlight-V100
+.Trashes
+ehthumbs.db
+Thumbs.db
diff --git a/Makefile b/Makefile
index 5a3d29f..5aa918f 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,8 @@
-CC = gcc
-CFLAGS = -std=c99 -pedantic -Wall -Wextra
-
-all: blatt09_1_2.exe
-blatt09_1_2.exe: blatt09_1_2.o
- $(CC) $(CFLAGS) -o blatt09_1_2.exe blatt09_1_2.o
-blatt09_1_2.o: blatt09_1_2.c blatt09_1_2.h defs.h
+CC = gcc
+CFLAGS = -std=c99 -pedantic -Wall -Wextra
+
+all: blatt09_1_2.exe
+blatt09_1_2.exe: blatt09_1_2.o
+ $(CC) $(CFLAGS) -o blatt09_1_2.exe blatt09_1_2.o
+blatt09_1_2.o: blatt09_1_2.c blatt09_1_2.h defs.h
$(CC) $(CFLAGS) -c blatt09_1_2.c \ No newline at end of file
diff --git a/defs.h b/defs.h
index 4bdd84c..a82beea 100644
--- a/defs.h
+++ b/defs.h
@@ -1,9 +1,9 @@
-#ifndef DEFS
-#define DEFS
-
-#include <stdio.h>
-
-typedef unsigned char u8;
-typedef unsigned long int u32;
-
+#ifndef DEFS
+#define DEFS
+
+#include <stdio.h>
+
+typedef unsigned char u8;
+typedef unsigned long int u32;
+
#endif \ No newline at end of file
diff --git a/main.c b/main.c
index fdf3783..d88ef1c 100644
--- a/main.c
+++ b/main.c
@@ -1,27 +1,9 @@
-#include "blatt09_1_2.h"
-
-Student studenten[3];
-
-int main()
-{
- studenten[0] = (Student) { "Anna" , "Musterfrau" , 22222 , "Am Schwarzenberg-Campus 3" , 4};
- studenten[1] = (Student) { "Hans", "Peter", 44444, "Kasernenstrasse 12", 2};
- studenten[2] = (Student) { "Lisa", "Lustig", 66666, "Denickestrasse 15", 8};
- print_studenten();
- printf("tausche 1 mit 3\n");
- swap(studenten, studenten + 2);
- print_studenten();
-}
-
-void print_studenten()
-{
- for (u8 i = 0, sz = sizeof(studenten)/sizeof(Student); i < sz; i++)
- printf("{\"%s\", \"%s\", %u, \"%s\", %u}\n", studenten[i].vorname, studenten[i].nachname, studenten[i].matrikelnummer, studenten[i].adresse, studenten[i].kurse);
-}
-
-void swap(Student *s1, Student *s2)
-{
- struct student buffer = *s1;
- *s1 = *s2;
- *s2 = buffer;
+#include "main.h"
+
+int main(int argc, char **argv)
+{
+ gtk_init(&argc, &argv);
+ GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+ g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);
+ gtk_widget_show(window);
} \ No newline at end of file
diff --git a/main.h b/main.h
index a653d50..ffba8f7 100644
--- a/main.h
+++ b/main.h
@@ -1,18 +1,9 @@
-#ifndef BLATT09_1_2
-#define BLATT09_1_2
-
-#include "defs.h"
-
-typedef struct student{
- char *vorname;
- char *nachname;
- u32 matrikelnummer;
- char *adresse;
- u8 kurse;
-} Student;
-
-int main();
-void print_studenten();
-void swap(Student *s1, Student *s2);
-
+#ifndef MAIN
+#define MAIN
+
+#include <gtk/gtk.h>
+#include "defs.h"
+
+int main(int argc, char **argv);
+
#endif \ No newline at end of file