Hey guys I was trying to add a pointer to the code below to that it will also count ints that occur in one line in a text file for example if in one line there was:
int j,l,k; int t; int p;.
But my pointer is all wrong could someone point out where I went wrong?
(I know this isnt the best way to do this using arrays but its the way I have to do it thanks.)
Code:char * ch = array; char array [200]; ifstream file; file.open(filel); if (file.is_open()) { while (file.getline( array, sizeof(array) )) { if( ( ch=strstr ( array, "int " )) != 0 ) { fint++; ch++ for (i =0; i <sizeof(array) ; i++ if (array[i]==',') fint++ if (array[i]==';') break; } }