#include <iostream> //std::cout
int main() {
static char buf[15] = "aacdefghijklmn"; // 15 char
const char* search[5] = { "a","c","d","f","g" };
int index[5] = { 0, 0, 0, 0, 0 };
for (int i = 0; i < 15; i++) {
std::string s(1, buf[i]);
for (int b = 0; b < 5; b++) {
if (s == search[b]) {
index[b]++;
std::cout << "found: " << buf[i] << " [" << index[b] << "] | buffer idx: " << i << " | search char: " << search[b] << " | search idx: " << b << " | mem: " << static_cast<void*>(&buf[i]) << std::endl;
}
}
}
}