String value to Char for isalpha() (C++) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

String value to Char for isalpha() (C++)

How do i convert a string with one letter to a char? I need this so that i can use the isalpha() function (from the cctype header) on it. Soo... how do i exactly do it (provide simple solutions and examples on real code so that my brain understands (if you can) )? Here's some code simulating my problem : https://code.sololearn.com/cFLTJST00x6V/?ref=app

10th Feb 2023, 12:48 PM
Dronto
Dronto - avatar
1 Answer
+ 4
str is a string type, even with single character. isalpha() argument should be a single character. So pass by index like int alpha = isalpha(str[0]);
10th Feb 2023, 1:04 PM
Jayakrishna 🇮🇳