• IMPORTANT: Welcome to the re-opening of GameRebels! We are excited to be back and hope everyone has had a great time away. Everyone is welcome!

Search results

  1. bitm0de

    [C] Tip: Avoiding Buffer Overflows With scanf()

    If you are choosing to parse strings with scanf(), maybe because you don't want to deal with the issues of '\n' with fgets() (even though there are still issues with scanf() aside from it being a more expensive function to call for grabbing a string without any special format because the format...
  2. bitm0de

    [C] Multiplication Table Display Example

    #include <stdio.h> void display_multiplication_table(int height, int width, int pad) { int i, j; for (i = 1; i <= height; ++i) { for (j = 1; j <= width; ++j) { printf("%*d", pad, i * j); } fputc('\n', stdout); } } int main(void) {...
  3. bitm0de

    [C] Generic Fibonacci Macro Implementation

    #include <stdio.h> #define def_fib(T) T fib_##T(T x) { \ int i; \ T n = 0, m = 1, tmp; \ for (i = 0; i < x; ++i) \ { \ n = n + m; \ tmp = n; \...
  4. bitm0de

    C++ Range-Based For Loop Iterator Wrapper

    Currently the range based for loop doesn't allow you to directly change the range in which it iterates. It simply iterates from begin() to end(). My wrapper class I created simply changes the semantics of what begin() and end() are to allow you to modify this range without reverting to the...
Top