You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem:
Missing function name in Data.xml for the call func_ptr_arr[1](); in Data.xml. Solution:
Gather the missing information during runtime and instantiate the dummy call accordingly. Sample Code:
#include <iostream>
void a(){
std::cout << "a" << std::endl;
}
void b(){
std::cout << "b" << std::endl;
}
int main(){
// declare array of function pointers
void (*func_ptr_arr[2])() = {a, b};
// call function b
func_ptr_arr[1]();
}
More advanced sample code:
#include <iostream>
void a(){
std::cout << "a" << std::endl;
}
void b(){
std::cout << "b" << std::endl;
}
int main(){
// declare array of function pointers
void (*func_ptr_arr[2])() = {a, b};
// get random index
srand((unsigned)time(0));
int i = rand() % 2;
std::cout << "i: " << i << std::endl;
// call function
func_ptr_arr[i]();
}
``
The text was updated successfully, but these errors were encountered:
Problem:
Missing function name in Data.xml for the call
func_ptr_arr[1]();
in Data.xml.Solution:
Gather the missing information during runtime and instantiate the dummy call accordingly.
Sample Code:
More advanced sample code:
The text was updated successfully, but these errors were encountered: