diff --git a/tests/run b/tests/run new file mode 100755 index 0000000..d47ba96 --- /dev/null +++ b/tests/run @@ -0,0 +1,4 @@ +#!/bin/bash + +gcc work1.c -o work1 +./work1 \ No newline at end of file diff --git a/tests/work1 b/tests/work1 new file mode 100755 index 0000000..38a4308 Binary files /dev/null and b/tests/work1 differ diff --git a/tests/work1.c b/tests/work1.c new file mode 100644 index 0000000..53bd904 --- /dev/null +++ b/tests/work1.c @@ -0,0 +1,41 @@ +#include "stdio.h" +#include "string.h" + +struct person_tag +{ + char name[20]; + char id[10]; +}; + +struct course_tag +{ + char course_name[20]; + int no_of_units; + int marks[4]; + float avg; +}; + +struct student_tag +{ + struct person_tag student_info; + struct course_tag course_info; + struct student_tag *next; +}; + +int main() +{ + + struct person_tag person, person2 = {"Chea", "4567892"}, *personPtr; + + // strcpy style + strcpy(person.id, "2345678"); + strcpy(person.name, "Sambo"); + + personPtr = &person; + + printf("Hello, %s \n", person.name); + printf("Hello, %s \n", person2.name); + printf("Hello Ptr, %s \n", personPtr->name); + + return 0; +} \ No newline at end of file