QP School
Writing clean and maintainable code in C - Printable Version

+- QP School (https://qomplainerzschool.lima-city.de)
+-- Forum: Tutorials (https://qomplainerzschool.lima-city.de/forumdisplay.php?fid=3)
+--- Forum: C 18 Tutorials (https://qomplainerzschool.lima-city.de/forumdisplay.php?fid=32)
+--- Thread: Writing clean and maintainable code in C (/showthread.php?tid=5112)



Writing clean and maintainable code in C - Qomplainerz - 07-25-2023

Writing clean and well-organized code enhances readability and maintainability.

// Bad coding style
int f(int x){int i=0;for(;i<x;++i)printf("%d ",i);return i;}

// Improved coding style
int print_numbers(int limit) {
    for (int i = 0; i < limit; ++i) {
        printf("%d ", i);
    }
    return limit;
}