can someone easily show me, how to call an array function with or without using pointer.

can you finish this code?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <iostream>
using namespace std;
void array(int num1[], int num2[], int num3[], int size);
int main(){

// I want to call the "array" function and display it on screen
  return 0;
}

void array(int num1[], int num2[], int num3[], int size){

// here I want to take 3 numbers from user using for loop

}

Last edited on
Please use code tags when posting code.

What have you tried?

Use code tags:



[code]

//Code Here

[/code]



To call the function, you'll want to give it 3 arrays, and their size (the arrays should all have the same size apparently):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <iostream>

using namespace std;

void array(int num1[], int num2[], int num3[], int size);

int main() 
{
	int a[10], b[10], c[10];

	//Note :: is needed to indicate we're calling the global function
	//and NOT initializing an "array" variable type
	::array(a, b, c, 10);

	return 0;
}

void array(int num1[], int num2[], int num3[], int size) 
{

	// here I want to take 3 numbers from user using for loop

}
jlb
Sorry didn't know, in the future, I will you use.


Zapshe

Thanks a lot, you easily solved my problem.
Topic archived. No new replies allowed.