0
How to add fiction to an array?
How to add function to an array???
4 Réponses
+ 3
( 🅰🅹 - ɪ'ᴍ ᴄʀɪᴍɪɴᴀʟʟʏ ɢᴏᴏᴅ! He might have learnt it elsewhere ^^)
What do you mean by that ? Passing an array as parameter to a function ? Returning an array ? An array of functions ? All that at once ? Obi wan Kenobi ?
+ 2
simple example:
#include <iostream>
using namespace std;
int funct1(int x, int y){
return x * y;
}
int funct2(int x, int y){
return x * y;
}
int funct3(int x, int y){
return x * y;
}
int main()
{
int myarr[] = {funct1(2, 4), funct2(2, 5), funct3(2, 6)};
for(unsigned int i = 0; i < 3; i++)
cout << myarr[i] << endl;
return 0;
}
...yet to work out how to do the same if the function are type void.
+ 1
You didn't start to learn C language and you are going in detail. How?
First go and learn about function and array. Don't ask such type of question before knowing about that.
0
What do you want to store if they return nothing ?