Skip to main content

All Questions

Tagged with
6 votes
3 answers
333 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
  • 165
7 votes
3 answers
990 views

Dynamic Arrays with Count / Capacity in C

I write in C for several projects (e.g. learning / teaching, coding competitions, data processing) and frequently need arrays (e.g. strings) with fast appending / concatenation / reversing. I've ...
Justin Chang's user avatar
  • 2,437
3 votes
2 answers
145 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
135 views

Generic Dynamic Array Implementation

I wrote a dynamic array implementation in ISO C11 using void pointers. Everything I've implemented works--at least in all my tests--on a 64-bit machine. It has some vague type-checking and resizes ...
Zenais's user avatar
  • 75
6 votes
4 answers
1k views

Automate character search in C

THE TASK We are dealing with a string of symbols and need quick responses to queries of the following types: What is the position of the k-th occurrence of symbol X in the string? Reading from ...
Wow1345's user avatar
  • 121
2 votes
2 answers
283 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
6 votes
1 answer
61 views

Chessboard configuartions with no possible capture on the next move

THE TASK: Given an NxM "chess"board and Q,R,B,K where Q is the number of queens, R the number of rooks, B the number of bishops, and K the number of knights find out how many possible ...
Wow1345's user avatar
  • 121
4 votes
2 answers
2k views

Linked list and array list performance comparison in C

After watching Stroustrup's presentation on performance comparison between vectors and linked lists (https://youtu.be/YQs6IC-vgmo?si=9r5wXqnwkmN29xqn), I've decided it would be a good problem to get a ...
low-altitude's user avatar
6 votes
3 answers
647 views

Redefining queue with different front and rear

...
Sai_krishna's user avatar
3 votes
3 answers
1k views

Small code exercise with 3D arrays in C

I wrote a small program that initializes a 3D array in C based on command-line arguments and prints it. I did my best to avoid undefined behavior and memory errors. I wrote comments as if I had an ...
schuelermine's user avatar
1 vote
2 answers
266 views

Count the number of mismatches between two arrays

This function may compute the amount of unequal elements of two char-arrays of the length n: ...
HeapUnderStop's user avatar
5 votes
1 answer
992 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
8 votes
4 answers
522 views

Array List C implementation

I want to show you my implementation of the array list in C. Is there something I can improve or fix? Header ...
whiteman808's user avatar
6 votes
2 answers
195 views

First attempt at making a sobel edge detection filter in c

I made a borders filter in C. It works properly, but I think it could be optimized and better designed; the formatting is abysmal. It uses too many lines for the border cases and has too many ...
GBA's user avatar
  • 63
3 votes
1 answer
134 views

C generic typesafe dynamic array (vector) try 2

The previous generic dynamic array I asked a review for here was written using only the preprocessor and so while the array itself was type-safe, all the manipulating macros where not. In this try I ...
Itai Nelken's user avatar

15 30 50 per page
1
2 3 4 5
13