Here's the deal. I have two arrays. One defining a character set(could be any length), and another defining a string. I want to switch every letter in the string with its placement on the character set. For example:
chrset[256] = "abcdefg"
string[256] = "gfdc"
will turn into:
chrset[256] = "abcdefg"
string[256] = 6, 5, 3, 2
This is my attempt:
#include <stdio.h>
#include <string.h>
int main() {
unsigned char string[256] = "cba";
char chrset[256] = "abc";
int count = 0;
while(&string[count] != NULL) {
string[count] = strpbrk(chrset, string[count]); }
printf("%d", &string);
return 0; }