Alright, so, I was kind of messing around and I noticed that this:
Doesn't work...Code:#include <iostream> #include <cstring> using namespace std; int main() { char a = 'x'; char b[10] = "xxaxxaxa"; int matchcount = 0; int len = strlen(b); cout<<len<<endl; for (int c = 0; c == len; c++) { if (a == b[c]) matchcount++; } cout<<matchcount; cin.get(); return 0; }
matchcount returns 0 no matter what. Could somebody please enlighten me as to why it's not working?