+ 1

Can anyone explain this code.

#include <stdio.h> #include <ctype.h> int main() { char c; c = 'z'; printf("\n %c->%c", c,tolower(c)); c='A'; printf("\n %c->%c", c,tolower(c)); c= 9; printf("%c->%c", c,tolower(c)); return 0; }

26th Jan 2020, 4:28 AM
Sachin Shah
Sachin Shah - avatar
4 Réponses
+ 5
Sachin Shah You are printing the value 9 as a char. 9 in ASCII is a horizontal tab character. http://www.asciitable.com/
26th Jan 2020, 5:16 AM
Hatsy Rei
Hatsy Rei - avatar
+ 3
https://devdocs.io/c/string/byte/tolower "... Converts the given character to lowercase according to the character conversion rules defined by the currently installed C locale... " Is there anything else you do not understand about the code?
26th Jan 2020, 4:40 AM
Hatsy Rei
Hatsy Rei - avatar
+ 1
Yeah thanks dude Hatsy Rei
26th Jan 2020, 5:21 AM
Sachin Shah
Sachin Shah - avatar
0
But in third case what happened Hatsy Rei
26th Jan 2020, 4:48 AM
Sachin Shah
Sachin Shah - avatar