Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <windows.h>
- #include <ctype.h>
- #include <stdio.h>
- #include <stdlib.h>
- int compar(const void* a, const void* b) {
- char a_[2] = " ";
- char b_[2] = " ";
- a_[0] = ((const char*)a)[0];
- b_[0] = ((const char*)b)[0];
- return lstrcmp(a_, b_);
- }
- int main(int argc, const char *argv[])
- {
- char ascii[128];
- int i;
- for (i = 0; i < sizeof(ascii); i++)
- ascii[i] = i;
- qsort(ascii, sizeof(ascii), 1, &compar);
- printf("%s", "The ascii characters are matched in the following order:\n");
- for (i = 0; i < sizeof(ascii); i++) {
- printf("Code %3d", ascii[i]);
- if (isgraph(ascii[i]))
- printf(" %c", ascii[i]);
- printf("\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement