P
Pete
Sorry for the ambiguity of my last post, What I am try to do is enter a 10
bit binary string
eg: 1110001010 and then permute them into an array using an array containing
3,5,2,7,4,10,1,9,8,6 as the index, so the 1st bit will be in the P10_out[3],
2nd bit in P10_out[5] and so on. I am sure the problem is to do with the
input string, it is each 1 and 0 of the input is not being read as
individual elements. Your help is much appreciated.
#include <stdio.h>
#include<string.h>
main()
{
int P10[10]={3,5,2,7,4,10,1,9,8,6};
int P10_out[10];
int i,index;
int input[10];
printf("\nEnter a 10 Binary Sting: ");
for(i=0; i<10; i++){
scanf("%c", &input);
}
for(i=0; i<10; i++) {
index = P10;
P10_out = input[index-1];
printf("P10_out = %d\n", P10_out);
}
}
bit binary string
eg: 1110001010 and then permute them into an array using an array containing
3,5,2,7,4,10,1,9,8,6 as the index, so the 1st bit will be in the P10_out[3],
2nd bit in P10_out[5] and so on. I am sure the problem is to do with the
input string, it is each 1 and 0 of the input is not being read as
individual elements. Your help is much appreciated.
#include <stdio.h>
#include<string.h>
main()
{
int P10[10]={3,5,2,7,4,10,1,9,8,6};
int P10_out[10];
int i,index;
int input[10];
printf("\nEnter a 10 Binary Sting: ");
for(i=0; i<10; i++){
scanf("%c", &input);
}
for(i=0; i<10; i++) {
index = P10;
P10_out = input[index-1];
printf("P10_out = %d\n", P10_out);
}
}