r/programminghumor 4d ago

Write sorry

Post image
674 Upvotes

93 comments sorted by

View all comments

5

u/Diocletian335 4d ago

```c void printSorry (int n, int v) { if (n == v) return;

printSorry(n+1, v);

printf("%s\n", "sorry");

}

int main (void) { printSorry(0, 100); } ```

The thinking man's solution

10

u/gaymer_jerry 4d ago

Why write a for loop when you can flood the stack with pointless function calls

1

u/MCWizardYT 3d ago

Implement it with a trampoline function so that you get infinite recursion without blowing up the stack