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
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
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
2 votes
0 answers
63 views

Reusable storage for array of objects V4

Here is a thirdfollow up on Reusable storage for array of objects, Reusable storage for array of objects V2 and Reusable storage for array of objects V3, taking into account the provided answers. The ...
Oersted's user avatar
  • 337
1 vote
1 answer
64 views

Reusable storage for array of objects V3

Here is a second follow up on Reusable storage for array of objects and Reusable storage for array of objects V2, taking into account the provided answers. The following code should be compliant at ...
Oersted's user avatar
  • 337
3 votes
1 answer
77 views

Reusable storage for array of objects V2

Here is a follow up on Reusable storage for array of objects, taking into account the provided answers. The following code should be compliant at least with gcc, <...
Oersted's user avatar
  • 337
4 votes
2 answers
539 views

Reusable storage for array of objects

My goal is to have a memory pool non-template class that is used to store arrays of objects. The same memory pool object must be reusable for a different array (difference size, different type and/or ...
Oersted's user avatar
  • 337
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
6 votes
6 answers
10k views

Left Shift/ Right Shift an array in C

I am trying to implement a Left shift/ Right Shift on arrays. I was able to accomplish this using double loops. Can the efficiency be improved? This is the working code for LeftShift/RightShift which ...
Vishnu's user avatar
  • 171
5 votes
3 answers
1k views

FizzBuzz, but with provided start and end of sequence, results stored in array, and a separate function to convert integers to strings

To learn C, I'm doing the traditional FizzBuzz challenge with extra restrictions: The start and end of sequence is provided by the user Instead of directly printing the results, the results must be ...
NPN328's user avatar
  • 771
-1 votes
1 answer
393 views

Scanning multiple strings in one line to a pointers array in C [closed]

I'm trying to write a code for a function that takes an empty array of pointers and its length n. And scans n strings of max length of MAX_LEN (a defined constant) until a new line is given by the ...
Coder48's user avatar
  • 171
2 votes
1 answer
153 views

A heap-allocated texture class for a console renderer

I am working on a console renderer and I want a heap-allocated dynamic texture class. Since I am quite new to C++, I just want to check the memory management, if I destroy all pointers correctly etc. ...
Jacob's user avatar
  • 43
3 votes
3 answers
296 views

Swapping int with string using getchar() and putchar()

I wrote code that replaces integers from 0 to 3 with strings. I was only allowed to use getchar() and putchar(). If the input is ...
momonosuke's user avatar
2 votes
1 answer
211 views

Multi-purpose generic pointer array with optional type-checking

I've been using this data structure in my projects for a while and finally decided to clean it up a bit and publish it online, but first I'm posting it here for code review. (EDIT: It has now been ...
Wingblade's user avatar
  • 233

15 30 50 per page