Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [c89]

This tag is for code written for the first standard version of C, also known as "C89", "C90" or "ANSI C", with amendments and technical corrigenda (as opposed to K&R C, C99, C11 or later C standard revisions).

Filter by
Sorted by
Tagged with
13 votes
5 answers
3k views

Portable old-school filesystem tool

I recently made a tool called mkfh to create a FHS compliant filesystem structure. I aimed to make it as portable as possible, so I wrote it in C89 and also tried ...
Labricecat's user avatar
6 votes
2 answers
4k views

128-bit integer type in GCC/Clang

When working on my projects, I often need a 128-bit integer type. For this purpose, I use the __int128 compiler extension. Here is the implementation I am currently ...
DaBler's user avatar
  • 309
3 votes
2 answers
123 views

Fast portable, parallel MSD radix sort for unsigned keys in C89

Now I have this portable, parallel MSD radix sort for unsigned keys. It exhibits linear speedup on small values of \$P\$ and has a running time of $$ \Theta(N/P + P)...
coderodde's user avatar
  • 28.5k
7 votes
2 answers
1k views

Assign determisitic Orcish names for debugging

Orcish Large volumes of unlabelled data are hard to visualize when debugging; I find it difficult to keep track of the pointers in memory. I have used this code to assign Orcish names, (it's a name ...
Neil's user avatar
  • 1,050
2 votes
1 answer
626 views

Robin Hood hashing

This is an implementation of a "string to int" hash table with Robin Hood hashing. I have tested it as thoroughly as I could. It appears to have no bugs/leaks. I would appreciate any ...
Aykhan Hagverdili's user avatar
4 votes
2 answers
109 views

Trigraph translator

Recently I thought about what a program would look like if all its characters that could become trigraphs became trigraphs. For example ...
nullptr's user avatar
  • 669
11 votes
1 answer
294 views

Portable BrainFuck Interpreter in ANSI C89

I wrote this BrainFuck interpreter in ANSI C89: ...
S.S. Anne's user avatar
  • 1,725
7 votes
3 answers
1k views

Cracking the Coding Interview — 1.5 One Away

I would like to know any suggestions about to improve my code solution and your rating of my approach to the problem, I based my code on the fact that if the strings have different length removing one ...
dariosicily's user avatar
  • 3,961
0 votes
2 answers
472 views

Cracking the code interview: Problem 1 .6 basic string compression

I created a GitHub repository containing my code solutions for some of the exercises proposed in the book. I updated my solution for the problem 1.6 here. Description A function that compress the ...
dariosicily's user avatar
  • 3,961
9 votes
2 answers
356 views

Generic data structures in C

I'm new to C, and I thought a great way to learn would be to implement some generic data structures and algorithms. So far I've implemented a linked list and a dynamic array. Both are generic, the ...
TheMax's user avatar
  • 91
3 votes
1 answer
70 views

Stern's diatomic series fusc: replacing #define functions with two return values

I have a function to review which implements Stern's diatomic series fusc for a single word (ulong = unsigned long) in place, as ...
Charles's user avatar
  • 509
4 votes
4 answers
922 views

Reading a text file that may have embedded nulls

I've always used fgets to read a file. However, I want to read a file that may have embedded \0. I thought of using ...
Neil's user avatar
  • 1,050
8 votes
0 answers
396 views

Engineering an even faster qsort

I understand that C++ STL template sort runs faster than qsort in C because ...
Neil's user avatar
  • 1,050
3 votes
1 answer
107 views

unordered_set: a hash table -based set data structure in C89

In this post, I present a hash table -based set data structure written in C89: unordered_set.h ...
coderodde's user avatar
  • 28.5k
2 votes
1 answer
59 views

Uni- and bidirectional pseudo-generic shortest path finders in C89

I have implemented two related shortest path algorithms for unweighted graphs in C89. My attempt was to learn some more idiomatic C constructs such as genericity (a client programmer should be able to ...
coderodde's user avatar
  • 28.5k
7 votes
4 answers
122 views

Label my cassette boxes

Historical Friday: this was my first useful C program, written around 1993-1994 (with only occasional access to a compiler and runtime environment). It's also my first non-trivial Postscript, too. ...
Toby Speight's user avatar
  • 76.2k