Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
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? ...
RudraSama's user avatar
  • 181
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 ...
Super Tux's user avatar
  • 313
5 votes
3 answers
384 views

Implementation of arrays that store their size

In this code I implemented arrays that store their own size before the first element. To access it you need to go back exactly sizeof(size_t) bytes back. To free it,...
yurich's user avatar
  • 157
3 votes
2 answers
160 views

Todo List app using C

I just learned to deal with pointers and memory allocation stuff. Using that, I built a todo list app, and it works as far as I tested it. I didn't account for many user errors, so any suggestion to ...
Sarthak Hingankar's user avatar
5 votes
3 answers
869 views

Safe(r) / Easier Pointer Allocation Interface in C (ISO C11)

I spent like half an hour programming up a set of functions to make the allocation / deallocate of pointers easier within a bigger project. I felt that they were satisfactory, but was wondering if ...
Zenais's user avatar
  • 75
2 votes
2 answers
292 views

Optimizing Subarray Removal: Can the Removal Process be Enhanced for Better Efficiency?

The only requirement is that it has to be done by pointers: And it returns the amount of removed numbers because of the way of output that is set in the main. The function, using exclusively pointer ...
eminbihh's user avatar
8 votes
3 answers
2k views

"Smart" (ish) pointer in C

I am a programmer with a primarily Rust-based background who has nonetheless taken an interest in C lately due to its simplicity and minimalism. However, one of the things I miss most from Rust is ...
JS4137's user avatar
  • 205
2 votes
3 answers
141 views

Exercises 5.1 from K&R (function to read an integer value)

As written [above], getint treats a + or - not followed by a digit as a valid representation ...
igor's user avatar
  • 21
7 votes
2 answers
246 views

simple connect four game

I made a simple connect four terminal game in C and was wondering if I could get feedback on it. I mainly want to know where pointers could have optimised my code, and if there are any major ...
Willem's user avatar
  • 71
5 votes
1 answer
1k views

Dynamic array type using void pointers C

I made my own dynamic array type using void pointers. I'd like to know what you think of my implementation. void pointers are nice but I fear they may be inefficient. The compiler cannot tell what ...
Lead Vaxeral's user avatar
12 votes
10 answers
3k views

Trim leading/trailing space in a string

I'm practicing C and wrote a function to trim leading/trailing spaces in a string: ...
roadsidejesus's user avatar
3 votes
1 answer
324 views

C void* Generic Hash Table

Some time ago I tried to make a generic linked list in pure C (no external libraries, only the C standard library) using void*s here. Building on top of that and ...
404 Name Not Found's user avatar
8 votes
1 answer
724 views

C void* Generic Linked List

I once tried to make a generic linked list in pure C (no external libraries, only the C standard library) here using C macros. With the same restrictions as in the previous attempt, this time I'm ...
404 Name Not Found's user avatar
4 votes
1 answer
522 views

Simple slab allocator in C

Here is the plan: a slab takes up 1 page and it has PGSIZE / blocksize amount of blocks the minimum blocksize is 8 bytes, otherwise the pointer to the next block ...
runningupthatroad's user avatar
2 votes
1 answer
456 views

C Program - Camel Case (creates or splits camel case variables, methods and class names.)

I have written a program in C, which does the following operations: creates or splits Camel Case variable, method, class names. Input format Each line of the input file will begin with an operation ...
jr.çhåvez__07's user avatar

15 30 50 per page
1
2 3 4 5
8