Pages: [1]   Go Down
Author Topic: Call function from an array  (Read 235 times)
0 Members and 1 Guest are viewing this topic.
Germany
Offline Offline
Jr. Member
**
Karma: 0
Posts: 94
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello everyone,

is it some how possible to call funktion from an array?

What i want to do is a Systemcheck depending on some events which happens. These events write data in an Array

char* syscheck[] = {"Timer" , "Sensor"};

syscheck now has the names of the funkctions which should be called.

Do i have to check every entry per hand and when it is in the array call the function "per hand" or can i somehow do a call direktly?

CL

PS my english is bad, so sorry for it   smiley-confuse
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24287
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, you can have an array of function pointers, but these are not the same as strings.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

California
Offline Offline
Faraday Member
**
Karma: 82
Posts: 3123
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Example of function pointer array:

http://stackoverflow.com/questions/252748/how-to-use-array-of-function-pointers
Logged

Germany
Offline Offline
Jr. Member
**
Karma: 0
Posts: 94
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the quick answers,

i tried to work as the exaple shows, but always get
Quote
invalid conversion from 'void (*)() to 'void*'

when i try compiling it with arduino
Logged

California
Offline Offline
Faraday Member
**
Karma: 82
Posts: 3123
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the quick answers,

i tried to work as the exaple shows, but always get
Quote
invalid conversion from 'void (*)() to 'void*'

when i try compiling it with arduino

There were multiple examples, so without seeing the exact code you are using and what line that refers to, it's a bit difficult to say...
Logged

Pages: [1]   Go Up
Jump to: