Originally Posted by
xixpsychoxix
are you still using the code that you had above?
Code:
#include <stdio.h>
void printset(int [] );
int main()
{
int i = 0, a[25] = {0};
printf("elements in array are:\n");
for(i=0;i<25;i++)
{
scanf("%d",&a[i]);
}
printset(a);
return 0;
}
void printset(int a[])
{int i;
printf("{");
for (i=0;i<25;i++)
{
printf("%d, ",a[i]);
}
printf(" }\n");
}
or did you rewrite it for your negative number thing?
well i have it modified to this now:
Code:
#include <stdio.h>
void printset(int [] );
int main()
{
int i = 0, j = 0, a[5] = {0}, b[5] = {0};
printf("Choose some numbers for set 1:\n");
for(i=0;i<5;i++)
{
scanf("%d",&a[i]);
}
printf("Choose some numbers for set 2:\n");
for(j=0;j<5;j++)
{
scanf("%d",&b[j]);
}
printf("Elements of set 1 are: \n");
printset(a);
printf("Elements of set 2 are: \n");
printset(b);
return 0;
}
void printset(int c[])
{int k;
printf("{");
k = 0;
for (k=0;k<5;k++)
{
printf("%d, ",c[k]);
}
printf(" }\n");
}
i'm trying to figure out how to do the negative number thing something in the for loop such as if (i = -1)
break;