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.

Filter by
Sorted by
Tagged with
0
votes
1answer
15 views

SubImage function implementation in C

This is a follow-up question for Two dimensional gaussian image generator in C, Two dimensional bicubic interpolation implementation in C and A SubPlane Method for Generic Two Dimensional Data Plane ...
3
votes
2answers
51 views

Two dimensional bicubic interpolation implementation in C

This is a follow-up question for Two dimensional bicubic interpolation implementation in Matlab and Two dimensional gaussian image generator in C. Besides the Matlab version code, I am attempting to ...
1
vote
1answer
29 views

tokenize char array with PolarSSL library

I'm trying to perform a decryption operation using RSA. I'm using the PolarSSl library. I have a char array key[] that contains RSA private key like the following, <...
0
votes
0answers
8 views

Cmake Can't Find Dependencies Not From Package Manager Of Distribution [closed]

Cmake 3.2 is very daunting for a beginner. I built and compiled successfuly an application but only due to the programm "checkinstall" helping me with one REQUIRED dependency. Kudos to the ...
10
votes
4answers
1k views

Unsigned 32-bit integer to binary string function

I've been trying to solidify my understanding of the binary number system by writing code. So, I tried to write a function with what I currently understand about the binary system that returns a ...
1
vote
0answers
47 views

In place dynamic array sorting without using extra memory

I seek critique on a sorting implementation for a dynamic array data-structure. Design decisions Uses the quicksort algorithm. Uses an optimized XOR swap for swapping the elements. XOR swap doesn't ...
4
votes
2answers
64 views

Two dimensional gaussian image generator in C

This is a follow-up question for Image Processing Median Filter in C. I am attempting to create a two dimensional gaussian image like below in C. The formula is as follows. The experimental ...
3
votes
1answer
39 views

Very simple scripting language (interpreter) in C

I made very simple scripting language (interpreter) in C and now, I want to make my code better. Here is my code: ...
3
votes
3answers
73 views

Image Processing Sobel Edge Detection in C

This is a follow-up question for Image Processing Median Filter in C. Under the same tiny bmp image read / write framework, a sobel edge detection function has been performed. The experimental ...
1
vote
1answer
25 views

A simple C WinAPI program for terminating processes via process image names - follow-up 4

(See the previous version here.) What's new get_last_err_msg renamed to MyGetLastErrorMessage The caller to ...
4
votes
4answers
97 views

Image Processing Median Filter in C

I am attempting to perform Median Filter with size 3 x 3 in C language. The function MedianFilter33 has been implemented as follows. The experimental implementation ...
0
votes
1answer
28 views

how to make inputs work well with special characters using the locale.h library? [closed]

for some reason the function setlocale(LC_ALL, "English") doesn't work when using an input function,(getchar, scanf, fgets,..), to get a special character, (Ç, ã, õ, é,...). ...
1
vote
1answer
58 views

C code in Data structures

Can someone give me any suggestions over my code that I made for this task? Also how much of 10 would rate it ? Suppose a simply linked list whose node is of type node and contains a student's name, ...
1
vote
2answers
57 views

Huffman compressor in plain C

I recently picked up C, because I am getting tired of the hell that is Java Enterprise development. I decided that writing a Huffman compressor will be a great little exercise, and I have always ...
3
votes
1answer
34 views

Writing a tail command clone

I'm reading Bruce Molay's book on Unix programming, and as an exercise I've implemented a copy of the tail command. My approach goes over the entire file once, to ...
1
vote
2answers
36 views

A [non-destructive] better (not really) `strtok` function

The first time I used strtok, it felt, well, weird. But after a while, I became quite used to it. In a way it was simple. Soon after reading a bunch of Stack ...
8
votes
7answers
1k views

Remove all unwanted characters from a string buffer, in-place

The following code was written with the intent to be as efficient as possible, where efficiency includes speed of execution, memory usage, and lines of code, all in support of the primary design ...
2
votes
1answer
29 views

Appending data to JSON file in C

I have this code which I use to append data to a JSON file. It will be helpful if someone could suggest pointers on: Reducing file opening and closing Make the ...
3
votes
1answer
58 views

Pomodoro timer daemon in C for BSD systems

I wrote a Pomodoro timer daemon for BSD systems in C (may work on Linux with -lbsd). The server uses poll(2) and sockets to communicate with the client and to ...
0
votes
0answers
22 views

Dynamic allocation, creating and accessing of structs of same struct

Trying to learn about structures (and pointers...). As my program works, I assume it is correct but asking here to make sure. As to my understanding, malloc is used to reserve some memory for all the ...
-2
votes
1answer
243 views

Squeak code generating C code for performant Reed Solomon error correction

You can read about my Squeak code release implementing ZXing's Reed Solomon Error Correction. It was suggested to me that I ask a question here. The speedup is 568% so far. NOTE: I got plugganized GF ...
3
votes
1answer
55 views

Simple Brainfuck Interpreter Implementation in C

I wanted to implement a short and functional brainfuck interpreter with minimal code repetition. It uses a little bit of macro magic, and does nested loops iteratively rather than using a cache, but ...
0
votes
1answer
35 views

Finding inorder successor of a BST in C [closed]

Please review this code I have written a function to find the successor of BST in c. It takes three arguments, i.e root pointer to the binary search tree, node value of which we have to find a ...
4
votes
3answers
157 views

C: Find and Replace in a text file (by a new programmer)

I'm new to C as in I've only studied it for a year and it's my first language. I still don't know how to handle real world code and so would like to see how a real world programmer would write up a ...
4
votes
1answer
84 views

fgetline_alloc An involved C function for reading lines of arbitrary length

Prototype: char *fgetline_alloc( FILE *fp, bool flush, int *nchars, bool eolend ); I realize this C99 function may be a bit more involved than expected, hence ...
2
votes
3answers
106 views

String join function C

...
6
votes
1answer
374 views

String lib in C

I am new at C programming, so I would appreciate it if you could highlight the problems in my code. My biggest concern is wrong memory allocation. There are some code snippets, where I repeat my code. ...
0
votes
1answer
48 views

Very unorthodox placement of if-else clauses in C for handling special cases [closed]

I've encountered a situation with an if-else clause. Specifically, the positive case has only 1 expression, whereas the negative case is a sequence of statements wrapped in braces. Like this: ...
2
votes
2answers
53 views

Move an unaligned bit-addressed range into another bitmap

Context I have an array of maximum-fixed-size, size, containers of items; these items are either pointers to objects or an index of the same array, (but no loops.) ...
1
vote
1answer
32 views

Create a random string with a set prefix [closed]

I was curious on how I could create a random string and have it have a set prefix. Lets say, as an example, 3456. This question is more referring to how I would join two strings together, my prefix ...
0
votes
2answers
79 views

Simple Win32 API Calculator in C

I've been learning C as my first language and recently I decided to learn how to create Win32 apps written in C. I Quickly realized, though, that my biggest challenge wasn't writing the Win32 app ...
3
votes
1answer
41 views

AVL Tree in C Criticism

I have made an AVL tree in C and coded the basic functionality of insertion, deletion, and search. I would love some criticism on my implementation especially on the insertion and deletion section of ...
7
votes
3answers
664 views

Input validation

I am learning C from C Primer Plus, and am still a beginner. I have been introduced to only two functions for input, scanf() and ...
1
vote
0answers
96 views

Implementation of the square root for real time application

For the real time control software I need square root calculation. I have heard that the sqrt function from the standard library isn't good choice due to the unpredictable number of iterations used ...
3
votes
2answers
67 views

Check if point is inside a bitmap shape

Inspired by this question, here's some C code to check if a point is "inside" of a shape on a simple black and white bitmap. For this exercise: Set bits form the "outlines" of a ...
0
votes
2answers
97 views

Filter a Linked List in Place in C

I have created the following function which filters a linked list in place (here it removes all instances of the element k), but it could easily be modified to take a function pointer as an argument ...
2
votes
2answers
61 views

Generate mask for non zero (or inverse) nibbles in integer

Apologies for the cryptic title, but the problem really is rather simple. I have a 64 bit integer which I interpret as 16 4 bit nibbles, or a nibble array if you wish, and I needed generate a mask ...
2
votes
1answer
99 views

Determine if a point is inside or ouside of an irregular shape on a bitmap [closed]

So this is my task: You are given an irregular shape on a bitmap. How do you determine if a point is inside or ousdie of the shape? We are allowed to assume that ...
0
votes
0answers
44 views

Quadratic Probing Hash Map - questions about implementation and testing

Quadratic Probing Hash Map Looking to improve my quadratic probing hash map. Here are some design considerations and questions. Implementation is made such that the hashing function, probing function ...
1
vote
3answers
103 views

C program to print a vertical english ruler whose length is given by the user

In this source code, i have writena program, using for loops, to print an english ruler whose length is given by the user. So what i want to know is that is it possible to modify this program, to ...
0
votes
2answers
99 views

Fixed memory manager in C

I decided to not use heap in my program and create a custom memory manager to retrieve memory chunks from a big global array of uint8_t(u8). I chose u8 since 8 bits is a byte. The very big ...
1
vote
1answer
81 views

Float to binary conversion

I wrote a program to convert float to it's binary IEEE754 representation in C. Any improvements to this is appreciated ...
3
votes
1answer
44 views

Making pixels of RGB barcode suitable for scanning

Similar to Microsoft's HCCB before its discontinuation near 2015, Im trying to make a 2D barcode that uses RGB pixels to encode more than two possible states (Black/White). Theoretically, at 100% data ...
0
votes
1answer
67 views

How to have a nested struct as linked list in C? [closed]

I am new in C and I have to do a project which reads data from a .txt file and created linked list of structures to different operation on that structures (CRUD). The file contains data of rooms in a ...
8
votes
4answers
161 views

Interactive shell for Arduino

Goal I needed to interact with microcontrollers (ESP8266 & ESP32) via the Serial interface, so I wrote a small interactive shell with the command pattern. The defined commands can either accept no ...
6
votes
4answers
845 views

Bytes to binary conversion function

I created a quick function to convert n bytes into binary for my student. She is not on that level yet, but I think it would be best for her if my demonstrative ...
2
votes
2answers
44 views

Merge Sort for Linked List Criticism in C

I previously implemented a Merge Sort for arrays, so after fixing up my code for the array-based merge sort I have now implemented a merge sort for a basic singly-linked list data structure which only ...
5
votes
2answers
241 views

C : Image Segmentation

My primary coding language is C++, but I occasionally use C. I wrote some simple image segmentation using Union-Find algorithm. Feel free to comment anything! ...
11
votes
6answers
3k views

Mergesort Criticism in C

I have written a merge sort in C and would like any advice on how to improve it. Any advice helps to make the code better! ...
2
votes
1answer
36 views

C test functions for 2D FFT

I made a function that directly calculates the discrete Fourier transform in dimension two, as well as functions that automatically initialize a 2D array to either something random, or specific basis ...

1
2 3 4 5
69