Type detection: Difference between revisions

Content added Content deleted
m (→‎{{header|Ring}}: Remove vanity tags)
m (→‎{{header|C}}: Remove vanity tags)
Line 22: Line 22:
The closest C comes to meeting this task, short of building it into the compiler or accessing memory segments via pointers, which is not guaranteed to be portable, is the ctype.h header file. It is part of the C Standard Library and provides 11 methods for detecting the type of a character, out of which the following 7 called in the wrapper function below can be called to be unique. The function accepts a string, but it actually checks the first character. An if ladder is used instead of if-else so that all function calls which return a non-zero value for the character are satisfied and the information is printed.
The closest C comes to meeting this task, short of building it into the compiler or accessing memory segments via pointers, which is not guaranteed to be portable, is the ctype.h header file. It is part of the C Standard Library and provides 11 methods for detecting the type of a character, out of which the following 7 called in the wrapper function below can be called to be unique. The function accepts a string, but it actually checks the first character. An if ladder is used instead of if-else so that all function calls which return a non-zero value for the character are satisfied and the information is printed.
<lang C>
<lang C>
/*Abhishek Ghosh, 10th November 2017*/

#include<stdio.h>
#include<stdio.h>
#include<ctype.h>
#include<ctype.h>