a pointer to a function, which can be stored in a variable allows a run-time choice of which function to run
0
votes
0answers
11 views
Pointers to functions that return a pointer inside a class
I need to implement a pointer to a function that returns a pointer. That should be easy, like:
typedef int* (*ptrInt)(const int);
ptrInt ptFunc;
And then,
int* foo(const int a) {
int* b = new ...
3
votes
5answers
88 views
Difference between pointer and pointer variable
I know this is very basic but it is little bit confusing to me.
I read that
a pointer is nothing more than an address, and a pointer variable is just a variable that can store an address.
...
-2
votes
1answer
63 views
Function pointer vs callback function [on hold]
I couldn't find a specific thread or website which answered this. When I look at tutorials for callback functions, they look exactly the same as function pointers. Only thing I can notice is that ...
-1
votes
1answer
41 views
C Function Pointer: passing argument x of 'y' from incompatible pointer type
I have a warning in my code which I would like to get rid off. I defined the following:
#ifdef __OS_LINUX__
typedef void* (*UAS_TASK_CALLBACK_T)(void* arg);
typedef pthread_t UAS_TASK_DESC_T;
...
1
vote
1answer
37 views
how to pass pointer to member function of a template class?
I just faced an interesting challenge, let's solve it together:
I had a Broker class similar to this:
//Broker.h
#pragma once
#include <boost/shared_ptr.hpp>
template<class ...
1
vote
4answers
50 views
is “function Pointer” in c++ similar in behavior with “delegate” in c#?
I have a small question.
is function Pointer in C++ similar in behavior with delegate in C# ?
0
votes
1answer
7 views
Apply matrix operation to every k-dim row in an n-dim matrix
Does octave have a method by which you can take a function which applies to every column in a 2-dimensional matrix and convert it into a function which applies to every line along the kth dimension in ...
0
votes
2answers
26 views
Getting a function pointer to a dynamic library in C (C89)
I have a function pointer to a dynamic library,
#include <GL/gl.h> /* or something */
void (*vertex)(float, float) = &glVertex2f;
On GCCi686-apple-darwin10-gcc-4.2.1 it's always worked, ...
-1
votes
0answers
10 views
How to use template function and pointer correctly?
I am reading someone's program and for better understanding of the idea I rewrite it into a small code. But when I try to compile I get some error. Thanks for the help.
#include <stdio.h>
...
0
votes
1answer
47 views
C, pointer to function in struct, warning “assignment from incompatible pointer type”
I have a struct defined as follow:
typedef struct {
char (*behave) (int*);
} BEHAVIOURSTRUCT;
this struct is defined in a .h file and it is included in the .c file
There i have a global ...
1
vote
2answers
75 views
Global function pointer. multiple definition error
I have some functions in delphi dll, and I want to load them (using QtLibrary) at once.
Can I store that functions in global variables to use it? I tried to declare global function pointer in .h file ...
8
votes
4answers
190 views
When is an array name or a function name 'converted' into a pointer ? (in C)
1) Misconception :
Whenever an array is declared in C language, a pointer to the first element of the array is created (the name of the array) implicitly. (Is it? I don't think so!)
The first two ...
0
votes
3answers
100 views
templated double-dispatching using function pointers
I’m trying to make a custom collision engine for academic purposes and I got stuck on a general c++ programming issue. I already have all the geometries which work properly and the collision test also ...
-4
votes
0answers
37 views
Pointers using poker game in C
I have to modify the poker.c program by moving all external variables into main and modifying functions so that they communicate by passing arguments. The analyze_hand function needs to change the ...
0
votes
2answers
61 views
c++ - Function pointer object seems not to to exist
I'm writing some kind of libary which organizes and keeps track of some tasks. Whenever a nwe task is called my libary uses a function pointer given in the constructor. But when I try to call it I get ...