// Zum Testen der in Assembler zu schreibenden Funktionen "tablecopy" und "bubblesort" // von Gerhard Raffius // vom 28.3.2016 // #include void tablecopy(int*, char*, int); void bubblesort(int*, int); char Table1[] = {9, -8, -7, 6, -5, 4, -3, 2, -1, 0, 127, 128}; int Table2[sizeof(Table1)]; void printtable(int* table, int n) { while(n--) printf("%d ", *table++); printf("\n"); } int main (void) { int i; tablecopy( Table2, Table1, sizeof(Table1) ); printtable( Table2, sizeof(Table2)/sizeof(int)); bubblesort( Table2, sizeof(Table2)/sizeof(int)); printtable( Table2, sizeof(Table2)/sizeof(int)); tablecopy( Table2, Table1, sizeof(Table1) ); printtable( Table2, 2); bubblesort( Table2, 2); printtable( Table2, 2); tablecopy( Table2, Table1, sizeof(Table1) ); printtable( Table2, 1); bubblesort( Table2, 1); printtable( Table2, 1); tablecopy( Table2, Table1, sizeof(Table1) ); printtable( Table2, sizeof(Table1)); bubblesort( Table2, 0); printtable( Table2, sizeof(Table1)); return 0; }