In the C programming language, islower() is a standard library function defined in the <ctype.h> header file. It is used to determine whether a given character is a lowercase alphabet or not.
The islower() function takes an integer (or an int) as an argument, which represents the character code. It returns an integer value, where a non-zero value indicates that the character is a lowercase letter, and zero (0) indicates that it is not a lowercase letter.
Here’s the syntax of the islower() function:
<span class="hljs-meta">#<span class="hljs-keyword">include</span> <span class="hljs-string"><ctype.h></span></span>
<span class="hljs-type">int</span> <span class="hljs-title function_">islower</span><span class="hljs-params">(<span class="hljs-type">int</span> c)</span>;
The c parameter represents the character code or value to be checked. It can be an int or any expression that evaluates to an int value.
Here’s an example usage of islower():
<span class="hljs-meta">#<span class="hljs-keyword">include</span> <span class="hljs-string"><stdio.h></span></span>
<span class="hljs-meta">#<span class="hljs-keyword">include</span> <span class="hljs-string"><ctype.h></span></span>
<span class="hljs-type">int</span> <span class="hljs-title function_">main</span><span class="hljs-params">()</span> {
<span class="hljs-type">char</span> ch = <span class="hljs-string">'a'</span>;
<span class="hljs-keyword">if</span> (<span class="hljs-built_in">islower</span>(ch)) {
<span class="hljs-built_in">printf</span>(<span class="hljs-string">"%c is a lowercase letter.\n"</span>, ch);
} <span class="hljs-keyword">else</span> {
<span class="hljs-built_in">printf</span>(<span class="hljs-string">"%c is not a lowercase letter.\n"</span>, ch);
}
<span class="hljs-keyword">return</span> <span class="hljs-number">0</span>;
}
Output:
<span class="hljs-selector-tag">a</span> is <span class="hljs-selector-tag">a</span> lowercase letter.
In this example, the islower() function is used to check if the character ch is a lowercase letter. Since 'a' is a lowercase letter, the condition is true, and the message is printed accordingly.
