All Questions
Tagged with function-pointers arrays
195 questions
1
vote
3
answers
91
views
How to organise big array of structs with function references in it? [closed]
I am trying to make readable/maintanable file that contains big array of struct instances, which have function reference in it.
Example of application, where this can be used, is user line command ...
1
vote
2
answers
165
views
How is filter function working for different types of pointers?
Writing a filter function that can handle different types of arrays in C!
I tried to write a filter function that takes an integer array and a callback function that evaluates to true or false. Based ...
0
votes
2
answers
1k
views
Could not convert from <brace-enclosed initializer list> to std::map
I am stuck on a problem and I know that some similar questions have already been posted here, but I have not been able to solve the problem yet based on their answers. Could someone please help me ...
1
vote
2
answers
370
views
How to access elements of an array of function pointers passed to a function by a void pointer?
I'm trying to pass an array of function pointers to a function by a void pointer. I cannot figure how to access the elements of the array inside the function they are passed to.
Example 1 - Pass ...
0
votes
0
answers
76
views
how to store variadic template functiont pointers in an array an then assign the functions to each pointer
Suppose I have the following functions:
static bool fun1(IOPin* obj) { }
static bool fun2(IOPin* obj, const bool& arg) { }
I want to be able to store pointers pointing to each of these functions ...
-2
votes
1
answer
223
views
question about two sum leetcode problem: brute force approach in C
I dont understand some small actions that has taken in this code, for example
i) why do we need to do &rs, why cant we just write
int returnSize;
p = twoSum(a, sizeof(a)/sizeof(a[0]), ...
1
vote
1
answer
48
views
Error initializing nested struct containing array of struct and function pointer c99 and gnu99
I am getting error during initialization of nested structure containing two members
unsigned int
typedef void (*vfptr)(void);.
The first structure or parent structure contains simply two variables ...
0
votes
4
answers
87
views
2d array pointer used in function
im writting a program in which i want to use this piece of code to transfer a 2d array in a function, but i dont understand fully how it works exactly. Can someone explain it, specifically line 7?
#...
1
vote
1
answer
719
views
llvm - Access And Call Function Pointer In A Global Array Without Horrible Pointer Hacking
I am having quite some trouble programmatically accessing a function pointer in a global array programmatically. I have a global array of function pointers, my "lookup table" which I ...
3
votes
3
answers
94
views
write a variable that takes a list of functions
I want to write a variable that takes a list of functions, is that even possible? to have a list of functions in C?
example:
// this type is for one function
void (*f)(void) = func1;
// but this is ...
0
votes
1
answer
37
views
Invoking function from the 2d array of function pointers
#include <stdio.h>
void test1(){ printf("test1\n"); }
void test2(){ printf("test2\n"); }
void test3(){ printf("test3\n"); }
void test4(){ printf("test4\n"...
0
votes
1
answer
93
views
How to pass an array of function pointers as an argument?
I have an array of function pointers int (*oper_ptr[4])(int, int) = {add, sub, mul, divi}; for the below functions which simply perform a standard operation on two passed integers:
int add(int num_a,...
0
votes
1
answer
72
views
How to declare an array that is received like parameter in a function that also receive a pointer to a function in C?
How to declare an array that is received like an parameter in a function that also receive a pointer to a function in C and that function is using the values from the array?
The function that use the ...
1
vote
1
answer
129
views
How to insert a structure instance inside a structure type array in c?
What do I want to do?
I want to make an array of struct types and insert struct instances into it.
{"struct Matrix matrix1", "struct Matrix matrix2"}
What have I done till now?
I ...
0
votes
0
answers
104
views
Creating an Array that uses a Varargs Struct with function Pointers
I'm currently learning about Varargs and now sitting in front of the Problem that I can't bring them in an Array and call them with e.g. a for-Loop.
Code:
#include <iostream>
#include <...