• Forum
  • Lounge
  • Without using built-in functions or thir

 
Without using built-in functions or third party library

How would one determine if a string literal is a digit, alphabetic character or symbol character (!,@, {, }, $, ^, %, etc) without relaying on ready made functions? Explanation with some sample code would be nice.
Simple.
1. Use simple logic with if statements.
if (c >= 'a' && c <= 'z')

2. Use a table.
const char *numTable = "0123456789";
Is there a reason you're specifying a string literal as opposed to a string?
Topic archived. No new replies allowed.