Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

2
votes
0answers
31 views

Simple Socket Server in C for Windows

I have taken the code from a tutorial of Microsoft webpage. Of course, the example is for illustration only but I wanted to organize it and make it clear in order to understand it a little more. Here ...
2
votes
0answers
47 views

Taskbar for X11 using Athena widgets

I am developing a simple taskbar for X11 using the Athena widgets. The current code is very limited: it assumes an EWMH-compliant window manager and only adds the initially running windows to the ...
2
votes
0answers
47 views

Simple generic macro-generated containers

In order to learn macros in C I decided to make a generic data structures generator for other projects that I have in C. The main macros are the following: ...
2
votes
0answers
36 views

Getting an element from RCU-protected list in kernel

I wrote a function, read_fox_rcu() for getting an element from RCU-protected list in a linux device driver. read_fox_rcu() reads ...
2
votes
0answers
62 views

CUDA kernel to compare matrix entries, weighted with a pattern

I wonder if it's possible to optimize this code in CUDA. Could I get any hints how to? Equivalent algorithm runs faster in Matlab for me, but there I'm doing matrix operations. Compution I'm not ...
2
votes
0answers
371 views

Max flow Ford-Fulkerson using DFS augmented path retrieval

I have written a naive max flow with DFS, could anyone review my below code. What can be done to improve the code and what are the worst cases where this won’t work acceptably? ...
2
votes
0answers
151 views

Simple Neural Network in C

A neural network is a structure of connections and nodes that takes input and generates an output. It can be "taught"(adjusting weights and biases of connections) from a teacher data set with ...
2
votes
0answers
89 views

Lock-free statically allocated async-interrupt-safe multi-consumer double buffer

I have a single threaded embedded system with nested interrupts. A writer interrupt will periodically update some global data structure with data. Reader interrupts / calls from main thread will read ...
2
votes
0answers
105 views

WinAPI 32 wrapper in C

This is a piece of code using this wrapper to create a simple window and handle some of it's events in Windows environment. ...
2
votes
0answers
58 views

Parse Mach-O binding info

I wrote this C program to open a Mach-O executable/framework and parse the external symbols along with their respective framework/library. A few things I would like to get better at: Memory ...
2
votes
0answers
289 views

IPC reader-writer without starvation

I'm trying to implement a functional version of the classic reader-writer problem in IPC which doesn't cause starvation. You can find the full article here The code is working. What do you think, is ...
2
votes
0answers
118 views

Changing window buffer and size in C with WinAPI

I wrote a code to change window buffer and size in a console app with C. Background: I had trouble with changing window buffer and size in C with WinAPI. Simply calling system("mode con cols=XX lines=...
2
votes
0answers
56 views

intersection of two arrays

I have written a logic to find out the intersection of two arrays. Please review my logic and guide me if my logical approach is not correct. ...
2
votes
0answers
50 views

Lex simple line-counting grammar

I'm trying to make a lex (flex) grammar that kicks out tokens while always being aware of the current line number. As an exercise, I made a simple grammar that accepts raw strings ...
2
votes
0answers
575 views

Thread-safe rand for C

I have this very short program for dealing with thread-safety of C's rand. Is it a correct implementation? ...
2
votes
0answers
332 views

Convert FoxPro/dBase DATETIME field to Win32 SYSTEMTIME struct

I'm trying to write a complete driver for Visual FoxPro's DBF format for Win32. I found that the way that fields of the DATETIME type are stored in dBase files is ...
2
votes
0answers
85 views

Yet Another Linked List

I've been populating my git with some old code, and I came across this linked list I wrote about 10-12 months ago. I'm wondering just how thread safe it is and if there are any improvements I can make ...
2
votes
0answers
612 views

Wrapper/abstraction for encryption and decryption using OpenSSL

I am a beginner when it comes to cryptography and OpenSSL. I have written a short wrapper of some functions in OpenSSL as well as a test of this wrapper, copied below. Specifically, this code is ...
2
votes
0answers
54 views

Updating a table when a process ends

I have the following piece of code. I would like to be able to combine my first big block if statement inside my while loop and clean up my usage of variables since I'm doing a lot of setting. I've ...
2
votes
0answers
64 views

2016 Advent of Code Day 2, Part 1 and Part 2

Continuing from yesterday, here's a simple solution in C to part 1 of Advent of Code Day 2. I used a simple state machine to map from each keypad key to the next keypad key given the input. ...
2
votes
0answers
167 views

libconfini (shared library)

I recently wrote a small INI parsing library. The code is also on GitHub, with documentation. I would like to have opinions, suggestions, and critiques. confini.h ...
2
votes
0answers
290 views

Multithreaded C program to calculate CPU usage of cgroups

I am writing a program in an environment that makes use of cgroups to identify and group processes together. I want to parse the CPU utilization of each cgroup by sampling ...
2
votes
0answers
1k views

Parallel Hillis-Steele Scan using CUDA

I'm learning CUDA (and C to some extent), and one of the algorithms that I am learning is the Hillis-Steele scan algorithm. I wrote a program that performs a simple scan with adding. After seeding ...
2
votes
0answers
107 views

MPI BMP image comparison

I made a simple program in which I compare two images pixel by pixel and determine if the pictures are the same. I'm trying to adapt it to MPI, but I'm afraid that the communications are taking too ...
2
votes
0answers
74 views

Convert tri-gram of type wchar_t to an integer type

I am trying to convert a tri-gram containing 3 characters of type wchar_t to an integer type (an uint64_t at the present time). ...
2
votes
0answers
68 views

N Processing connect to a single process: Socket Programming

The idea of my program is to use pthreads, semaphores, posix shared memory, and sockets to create an environment where N processes (that we will refer to as the children) can connect to a single ...
2
votes
0answers
204 views

Windows AppLocker extension - Owner rule

I am trying to extend Windows AppLocker behavior to add custom rule which checks owner of executables in Program Files and Windows folders. This would help us patch folders that are writable by ...
1
vote
0answers
37 views

Prompting the user to input a data value into an element in a linked list

I'm working through a practice problem that is having me build and modify a linked list over a series of steps. I am particularly interested in knowing if there's a more elegant way of prompting the ...
1
vote
0answers
26 views

Sort an array of strings using bubble sort

I have this following code to sort an array of strings order by ASCII value (alphabetically) using bubble sort. ...
1
vote
0answers
35 views

Convolutions with shared memory in CUDA

I am writing a noise blur convolution kernel in CUDA ...
1
vote
0answers
44 views

C Generic Sorted Doubly-Linked List

I just finished this big project. Its is called SortedList and it is implemented using a Doubly-Linked List. It data is of type ...
1
vote
0answers
63 views

selecting 5 best players out of 2 team

Let us assume that we need to develop an application which can select best 11 players to score maximum points. The application will select the best players after completion of a match. The rules are ...
1
vote
0answers
93 views

Neural Network Backpropagation

My neural network is buggy somewhere. However, the reason I am posting here and not Stack Overflow is because a buggy neural network can still be trained to some degree and will compile/perform better ...
1
vote
0answers
84 views

System on Chip Validator

With reference to my source files, published in the git repository soc-testing I did my best effort at coding, based on 30 years of experience, so I would like to know what I did wrong with my ...
1
vote
0answers
70 views

Simple overlapped IO single threaded client

I wanted to make a single threaded network client that only uses a single connection to a server. IOCP seems like overkill but overlapped IO with event notification I think is the most performant of ...
1
vote
0answers
110 views

GLSL Simplex Noise with derivatives

I recently made 2d simplex noise based coherent noise in GLSL. [Here] is the shader toy. I wanted to make an implementation of simplex noise on the gpu in order to get better performance than the CPU ...
1
vote
0answers
83 views

Server Client in socket c

This is a lib I am doing to interact with sockets. :) Here is the main file: ...
1
vote
0answers
32 views

Sending AT commands via switch case in Arduino

Is this the proper use for switch case? I am looking to make a simple utility for reporting back Wireless AP info, Baud Rate, and Mode of a ESP8266 module. When the program loads it gives the user a ...
1
vote
0answers
137 views

Matlab and WidowX robot arm communication and control

For a class, we needed to control the WidowX arm from Trossen Robotics from Matlab and get as real-time of a feedback as possible. So I came up with a code for the Arbotix Robot-controller which is ...
1
vote
0answers
411 views

Deletion of Word from Ternary Search Tree where Both Siblings Present

This code review will require somewhat a more indepth look at the code operation (at least it did for me) to understand the two word deletion areas and the node rotation and frees I'm most concerned ...
1
vote
0answers
64 views

Computing butterflies with better performance

I have a code that computes butterflies and from a little profiling I found out that it is a little bit slow. So, it seemed that the better way to optimize its performance is vectorizing it using ...
1
vote
0answers
74 views

Fetch value from website using cURL

I want to make a http request, get the website content and check one specific element. Currently I'm doing it with lcurl (got explanations from a tutorial). Here is an excerpt of my code: ...
1
vote
0answers
34 views

Secure local Interprocess communication

I wrote the SlipRock library for secure local interprocess communication. It is designed to be secure against untrusted users running on the same machine, or any user running on any other machine. ...
1
vote
0answers
2k views

Deque using doubly linked list

I was trying to implement a deque using a singly LL when I realized that eject() (popping the tail element) wasn't going to work without a pointer to the previous ...
1
vote
0answers
1k views

Breadth-First Search in C: Maze-like use of 2D arrays, linked list

Problem: In a grid of nodes pick a starting node(has mode2), and using Breadth-First search, find one with a ending node (has mode1). You can make walls so it's harder for the search. And that ...
1
vote
0answers
109 views

List interface implementation

After following the comment from greybeard, Below is the design for given first phase of implementation, Code directory structure, ...
1
vote
0answers
65 views

Arduino sketch running on Arduino Mega as a web server

I have Arduino Mega with Ethernet shield mounted on top running as a web server. It reads temperature, humidity, rain or not and pot soil moisture and then displays on web page. Can you please review ...
1
vote
0answers
217 views

Generic natural merge sort a linked-list in C

I have a .h file that implements my "generic" by defining LINK_* beforehand. This is an implementation of natural merge sort on doubly-linked lists using log n ...
1
vote
0answers
51 views

Improving a CGI Server in C

I made a simple CGI server in C, and I would like to have your opinion on my code quality. This would help me to improve. ...
1
vote
0answers
459 views

Generic Pairing Heap Performance

I have made a generic pairing heap library in C. Pairing heaps are one of the several heap variants with better asymptotic running times than standard binary heaps (others include Fibonacci heaps and ...