- 985

- 121

#include <stdio.h>

#include <stdlib.h>

#include <time.h>

#define cards 15

#define sides 2

void bubblesort(int items[cards][sides]);

int main()

{

int i, stime;

long ltime;

ltime = time(NULL);

stime = (unsigned)ltime/2;

srand(stime);

int deck[cards][sides];

for(i=1;i<=15;i++)

{ deck

*[0]=i;*

deck

deck

*[1]=rand();*

printf("%d ", deckprintf("%d ", deck

*[0]);*

printf("%d\n", deckprintf("%d\n", deck

*[1]);*

bubblesort(deckbubblesort(deck

*[0]);*

}

return 0;

}

void bubblesort(int items[cards][sides])

{

int a,b,c,d,t;

for(a=1;a<=cards;a++)

for(b=0;b<sides;b++)

{

for(c=cards-1; c>=cards;c--)

{

for(d=sides-1; c>=sides;d--)

if(items[c-1][d-1] > items[c][d])

t=items[c-1][d-1];

items[c-1][d-1] = items[c][d];

items[c][d] = t;

}

}

}

it keeps on returning the same 2 errors

initializing argument 1 of void bubblesort(int (*)[2])

and invalid conversion from int to int(*)[2]

I'm not sure what kind of 'conversion' is going on; I've tried changing the variable array for bubblesort to pointer and to memory address but that gave extra errors; any help on what I might be doing wrong is appreciated}

return 0;

}

void bubblesort(int items[cards][sides])

{

int a,b,c,d,t;

for(a=1;a<=cards;a++)

for(b=0;b<sides;b++)

{

for(c=cards-1; c>=cards;c--)

{

for(d=sides-1; c>=sides;d--)

if(items[c-1][d-1] > items[c][d])

t=items[c-1][d-1];

items[c-1][d-1] = items[c][d];

items[c][d] = t;

}

}

}

it keeps on returning the same 2 errors

initializing argument 1 of void bubblesort(int (*)[2])

and invalid conversion from int to int(*)[2]

I'm not sure what kind of 'conversion' is going on; I've tried changing the variable array for bubblesort to pointer and to memory address but that gave extra errors; any help on what I might be doing wrong is appreciated