Project design
- C course
- Intermediate
- Lesson 112/116
- 6 min
Design the skeleton of the intermediate final mini app.
Project: Task manager
In this five-lesson final project you'll build a task manager. Each lesson adds a piece; by the final lesson you'll have a program that saves, loads and lists tasks.
The project combines struct, linked list, function pointer and file I/O from earlier groups. In the first lesson you define the Task struct and the global list; main prints a greeting. In later lessons you'll add task creation, list insertion, filtering, saving to file, and finally integrate everything.
The Task struct
A Task struct holds a task's name, priority and the next task in the list. It is defined with typedef; a next field points to its own type via struct Task *.
Declaration: typedef struct Task { char name[32]; int priority; struct Task *next; } Task;. The next field is the backbone of the linked list; each node links to the next. The list ends with NULL. The global g_list variable holds the head; it starts as NULL. This structure is the core of dynamic data management.
Practice Write the project skeleton
Define typedef struct Task { char name[32]; int priority; struct Task *next; } Task;. Declare Task *g_list = NULL; for the list head. In main print printf("Görev yöneticisi hazır\n");.
Starter code
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// Task yapısını typedef ile tanımla (name, priority, next)
// g_list işaretçisini NULL olarak tanımla
// main "Görev yöneticisi hazır" yazdır
int main(void) {
return 0;
}Sample solution
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct Task {
char name[32];
int priority;
struct Task *next;
} Task;
Task *g_list = NULL;
int main(void) {
printf("Görev yöneticisi hazır\n");
return 0;
}Expected output
Görev yöneticisi hazır
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 What does the next field of Task do?
- Points to the next task in the list Correct answer
- Holds the task name
- Stores the task priority
- Holds a file name
Explanation: next points to the next node in the linked list.
2 Complete the greeting message
printf("Görev yöneticisi ____
");
printf("Görev yöneticisi hazır
");
Explanation: "Görev yöneticisi hazır" is the greeting.
3 Match the Task fields
| Term | Meaning |
|---|---|
name |
Task name |
priority |
Priority |
next |
Next node |
g_list |
List head |