C99 is a standard for the C programming language. It replaces the previous C89 standard, and is succeeded by the C11 standard. C99 added inline functions, C++-style comments, allows intermingled declarations and code, as well as multiple other language and library fixes and additions.
4
votes
2answers
67 views
File chunk buffer for Windows programs
The purpose of the ChunkBuffer code below is to designate a "chunk" from a given input file and to loop that chunk (if needed).
Its operation is similar to the ...
6
votes
1answer
53 views
Counting sort implementation in C
I've just implemented counting sort in C and would like to hear your opinions on it. As I'm usually being rather picky when rating other people's code, please go ahead and be picky, too -- I will try ...
2
votes
2answers
67 views
IPC using pipes
I have simulated the conversation between a caller and receiver using fork and pipe. The parent process is the receiver and the child process is the caller. Each message is terminated by a newline.
...
4
votes
2answers
144 views
Dynamic Array container in macros
The code below is an attempt to mimic std::vector from the C++ standard library in the C language.
The implementation is purely macros, in the C99 dialect, and ...
0
votes
1answer
37 views
colorprint - part 2
This is a followup of the last review to comply with meta's rules.
In the last, I posted a small library called colorprint and got some helpful pointers from chux ...
3
votes
1answer
29 views
colorprint - An ANSI Escape sequence console writer mini-library
I wrote this a long time ago. I came back to it and decided to clean it up a little.
It uses the preprocessor and C99 anon structs to make a flexible python-like ...
2
votes
0answers
56 views
Rust-like “Result” in C - nicer error handling
There are frequently things I miss when using C; one of them is a nice error-handling (exception-like) system. After trying Rust, I realized I could implement something similar in C itself. So here's ...
11
votes
3answers
171 views
Dijkstra's algorithm in C99
I just implement Dijkstra's algorithm in C99. Can you review my code please? I'm looking for any mistake, performance improvement or coding style errors.
main.c
...
4
votes
1answer
42 views
YAGOP - Yet Another Generic Object Pool
While thinking about this question it struck me that one problem of linked data structures always seems to be loss of memory locality and performance could possibly be improved if all allocated nodes ...
6
votes
2answers
56 views
Implementation of the ls command with several options - follow-up 2
I've made more improvements from previous iterations and my own, including:
Added the -n flag (print owner and group IDs instead of names)
Eliminated some ...
11
votes
2answers
110 views
Implementation of the ls command with several options - follow-up
I've made vast improvements to my previous ls implementation, including:
Added new flags:
-g (omit owner listing)
...
15
votes
3answers
1k views
Implementation of the ls command with several options
As part of a past assignment, I've expanded on this implementation of ls to have more options available, including non-standard ones.
It currently supports these (...
5
votes
1answer
79 views
Calculating diagonal difference
I was trying to solve a problem concerning the difference of the diagonal sums of a matrix (using C99):
...
2
votes
1answer
268 views
Postfix evaluation using a stack in c
I have written a program to evaluate a postfix expression using a stack. I had my stack implementation using a linked list reviewed here, so I am only including the header file here.
I have taken ...
5
votes
2answers
272 views
Stack implemented using a single linked list
I am studying data structures and I have implemented a stack using a linked list.
stack.h
...
3
votes
4answers
772 views
Simple singly linked list implementation in C
I have implemented a LinkedList with the ability to add, get elements from a particular position and ability to show all the elements in the array in to the console ...
5
votes
1answer
75 views
Program to tell which if any of three numbers is in the middle
I wrote this program, and it does what it asks, but it's so big and ugly. What can I change?
Some examples:
...
4
votes
2answers
117 views
Low level string manipulation functions in C
I'm working with a legacy program that does a bunch of markup manipulation, some of it higher-level and specific to the proprietary markup, some of it lower level string stuff.
I rewrote and ...
7
votes
2answers
133 views
Reverse engineering Darkstone game archives
Reverse engineering old games is something I do every now and then. This time, I took a shot at this old RPG called Darkstone.
The bulk of the game's data is stored in archive files with the ...
6
votes
1answer
121 views
Simple procedural image patterns
I have these functions for generating procedural debug data for another piece of code related to image processing. The three following functions generate these simple mechanical patterns, which are ...
8
votes
4answers
482 views
Simple compression algorithm
An implementation of a simple compression algorithm that's featured in a programming practice book.
My goals:
Robust: All error conditions must be handled properly. The specification indicated in ...
4
votes
2answers
217 views
Algorithm (and tests) to parse lists of unsigned 32-bit ints from strings in C
What?
I have an algorithm that parses comma separated lists of unsigned 32-bit ints from strings. Here is an example of what a list could look like:
...