Right now i am testing for ch, and before pch tests for ; ch is null
so the program should end there itself when ch is null, why would it continue till pch??

The point is that ch is not NULL. Check the debug printf in my post

ok, but why is it happening? strtok should return the null pointer when no : is found

now wat it seems like is tht u r facing the same lid problem of buffer stacking in c/c++....using command to flush buffer may help u out!!!!!!!

Dont use scanf and gets for string input. Instead use fgets which is decribed in the second this of my previous post. You need to flush the input buffer (how to do that read the first this of my previous post). You need to flush the input buffer becouse if you not flush it you it will be unable to input the string second time. Please post your code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.