I know that I can return an array with pointers. But when try to make this in two functions like that;
int* decToBin(int num){
int binAr[100], i = 0;
while(num != 0){
binAr[i] = num % 2;
num /= 2;
i++;
}
binAr[i+1] = '\0';
return binAr;
}
int modExp(int b, int e, int m){
int* expoBin = decToBin(e);
int i = 0;
while(expoBin[i] != '\0'){
printf("%d", expoBin[i]);
i++;
}
return expoBin;
}
I cant get any output. I know that I'm missing a silly point but I can't figure out.