I have trouble passing an array to my assembler program. The thing is - I have an array "srt" which contains different characters for example "glammrr" and the assembler program stores into the array "set" only the differentiating characters - in this example it would be "glamr". And the array res counts the characters, in this example - "1,1,1,2,2". Now, I pass the res array as char * to the assembler program and everything's cool. But I have a problem with the int array.
In a similar task a fellow student had - he didn't have an int array, but only a single integer, so he called function like this APAR(str, strlen(str), &res, set). I don't know what to do in my case. Any ideas?
here's the C part.
Code:
#include <stdio.h>
int main(int argc,char *argv) {
int res[8];
int i;
int l=8;
char srt[ ]="glammrr";
char set[ ]="";
void APAR(const char *, const int, int *, char *);
APAR(srt, strlen(srt), res, set);
for (i=0; i<l; i++) {
printf("%c",srt[i]);
}
printf("\n");
for (i=0; i<l; i++) {
printf("%c", set[i]);
}
printf("\n");
for (i=0; i<l; i++) {
printf("%d", res[i]);
}
}
btw I tried passing an array pointer to the assembler program, but that didn't work because I don't know how the assembler program can handle a pointer.
Also, I know the problem is here because the assembler program correctly produces the set array and it works correctly when is given a single number.