Questions tagged [c]
C is a general-purpose computer programming language used for operating systems, games, and other high performance work and is clearly distinct from C++. It was developed in 1972 by Dennis Ritchie for use with the Unix operating system.
4,092 questions
6
votes
2
answers
987
views
Project Euler #909: L-Expressions I
I am trying to solve the 909th challenge of Project Euler. It is basically about replacing specific patterns in a string until no pattern is found. A given string like ...
2
votes
1
answer
124
views
ds (directory switcher): a *nix program for tagging directories with (short) tags and switching between them via tags
Repo
The complete program: GitHub repository
How it works
After you have cloned the above repository, change directory inside it and type make in order to compile ...
11
votes
4
answers
1k
views
A simple server-client application in C
I am reading "The Linux Programming Interface" by Michael Kerrisk. I'm studying about sockets, and I made a simple application using sockets on the unix domain.
I want to know if I'm using ...
4
votes
1
answer
103
views
Lock-free queues and stacks
I am currently working on implementing lock-free stacks and queues. So far, they seem to function properly in test programs, but I am unsure if there are any underlying issues or areas for improvement(...
14
votes
5
answers
2k
views
I implemented FFT in C
I wrote Cooley-Tukey's FFT algorithm in C. And I want to know how safe is this code? Is it just trash? How can I make it more memory safe?
...
6
votes
0
answers
146
views
Markdown parser library in C
For a side project, I needed a markdown parser and I decided to roll my own.
It is a SAX-style parser, i.o.w. you can hook into parser events on consumer side and do whatever you want with the content....
8
votes
1
answer
579
views
Shared-Memory Queue Implementation in C
Recently I am working on implementing a shared-memory based IPC message queue in C programming language on Linux system. A few design choices I've made include
The queue will have only 1 producer, ...
11
votes
2
answers
1k
views
Parsing HTTP headers in C
I'm new to C and just finished K&R. This is a code that I've written to parse headers of a HTTP request.
I want to know if my code:
Is safe? (after all this is C)
Does proper exit on failure? Are ...
10
votes
6
answers
2k
views
k-Nearest Neighbors algorithm in C
I've been learning C for a while, and I decided to make a simple kNN program. What can I do to improve the program?
Am I doing memory management right? Can the structure of the code be improved in ...
3
votes
0
answers
47
views
library variant during application startup
I wrote some PoC for load library with best optimization version during application startup. The goal for it check in the _init function code checking by cpuid ...
7
votes
4
answers
1k
views
Rot13 encryption with extra functionality using unix flags
I just wanted to check out options/unix flags and read from stdio through pipe. Is it any good? Where should I improve or use something else? Feedback would be much appreciated.
...
7
votes
7
answers
2k
views
LinkedList data structure in C
Is my logic good? Are variable names fitting? Are there any memory leaks? Am I doing anything dangerous (this is C after all)?
Please feel free to criticize the code. I want to know if I'm writing C ...
9
votes
5
answers
2k
views
C method to determine whether a byte array is homogeneous
I engineered myself into a situation where I wanted to check whether a region of memory consists of identical bytes. I wanted to at least try to avoid the obvious solution of an O(n) loop, but also ...
2
votes
1
answer
181
views
Attempt at a Different Variation of the strstr(...) Function
I decided to work on an idea I had to 'optimize' the classic C function strstr.
Most of the implementations I had seen that did not make use of advanced ...
5
votes
4
answers
644
views
Single Consumer Single Producer Wait-Free Zero-Copy Circular Message Queue
The title describes pretty well what the algorithm is for. It will be used for a realtime inter-process communication library that only uses shared memory for exchanging data. For realtime systems, it'...