I need help figuring out whats wrong with my intersection function.
I have to get 2 sets of arrays from the user then find the intersection and print it out.
Code:
#include "stdafx.h"
/*function prototype*/
void getSet1(void);
void getSet2(void);
int findint(int inter[]);
void printInter(int Array[]);
int _tmain(int argc, _TCHAR* argv[])
{
getSet1();
getSet2();
findint();
printInter(findint);
return 0;
}
void getSet1(void)/* Set1 */
{
int i;
int set1[10];
printf("Enter First Set");
for(i=0;i<10;i++)
scanf("%d",&set1);
}
void getSet2(void)/*Set 2*/
{
int i;
int set2[10];
printf("Enter Second Set");
for(i=0;i<10;i++)
scanf("%d",&set2);
}
int findint(int inter[])/*intersection*/
{
int i;
int j;
int k;
getSet1();
getSet2();
for(i=0;i<10;i++)
{
for(j=0;j<10;j++)
{
}
if(getSet1[i]==getSet2[j]);
{
k++;
}
if (getSet1[i] != getSet2[j])
{
k=NULL;
}
}
return k;
}
void printInter(int Array[])/*print out intersection*/
{
int k;
for(k=0;k<10<;k++)
printf("%d",Array[k]);
}