Relative Content

Tag Archive for carrays

constexpr sorted array of struct key value how to search it efficiently?

I have a long array of key+value data that I would like to initialize into my source code with constexpr initializer. I can sort the array myself in the source code, so it could be efficiently searched with a binary search algorithm. The structure has a key part and one (or more) value parts.

Reverse an array in c

I checked some videos of reversing an array in C therefore I know that my logic is correct. Here’s my code:

How do I iterate over this array of arrays of chars?

I was trying to iterate over an array of extension names returned by glfwGetRequiredInstanceExtensions() which is a part of the GLFW API. But I am a little uncertain of the functions return type const char** which I have never seen before. From reading this stack overflow post it seems this is an array of arrays of chars. At first I tried iterating over the array in the following way:

How to pass a C style array to another function by reference [duplicate]

This question already has answers here: What is array-to-pointer conversion aka. decay? (11 answers) Closed 2 mins ago. Yes I do know how to actually create a reference to a c style function. But when I try to pass an array by reference it gives me the “no matching function” error. I first take in […]