Quote:
Originally Posted by sokha
how to make a function to check an input chars contains numbers (started from the second element).
|
Your examples did clarify that ambiguous specification. But you should learn to specify behavior with less ambiguity. Such as
Return true if every character, from the second through the last inclusive, is a digit.
Return false otherwise.
Quote:
Originally Posted by smeezekitty
(ip[p] >= '0' || ip[p] <= '9')
|
The overall logic of your answer would be wrong even if the test (what I quoted) were correct. Maybe you misunderstood the ambiguous description of the problem. (Maybe you answered before the first post was edited and maybe then it was even less clear than it is now).
But look at your test itself. I hope you can see it doesn't test anything, it is always true.
Quote:
Originally Posted by sokha
I encounter a problem
|
Is this a homework assignment?
If you know how to program in C (even just a little) this function should be trivial.
If this is homework,
we should not be giving you a final answer, just explanations and ideas.
If this isn't homework, you're trying to do something you're not ready for yet. Go through a C tutorial and learn the language a little before trying to program in it.
Smeezekitty apparently got careless in coding and also misunderstood your problem specification. But at least he demonstrated the basic concepts required for the task.