Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
- char * inKtu(char * str) {
- int A[255];
- int j = 0;
- char * kq = (char *) malloc(255); // Khai bao string.s
- for (int i = 0; i < 255; i++) A[i] = 0;
- for (int i = 0; i < strlen(str); i++) {
- if (str[i] == ' ') continue;
- if (A[str[i]] == 0) { // Ky tu cung dc hieu ngam la so!
- A[str[i]] = 1;
- kq[j++] = str[i];
- }
- }
- kq[j] = '\0';
- return kq;
- }
- int main() {
- char str[] = "Hello World";
- char * kq;
- kq = inKtu(str);
- printf("%s",kq);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement