how to seperate numbers letters in string in c

Recommended Answers

All 2 Replies

I'm not sure if you want to separate numbers FROM letters, or numbers AND letters, but:

if FROM:
Numbers have lower ascii values than any letter, so any char less than 'A' can't be a letter.

if AND:
Remember that a pointer or index can "walk" a string array, or a block of memory, and thus individually allow your program to work with any single char you want to work with. In essence, they are already separated, since each one can be dealt with individually.

If you have more questions, please be specific, show us your attempt at solving this problem, and give an example of what you want, as well as a description.

Specifics are VERY important, in programming.

You may need to post your program or be more specific like Adak says.
Are you trying to recognize the type that categorizes numbers and letters such as int and char or the %type u need for scanf?

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.