fork(1) download
  1. #include <stdio.h>
  2. #include<string.h>
  3.  
  4. void RemoveDuplicates(char* str)
  5. {
  6. int a = 0,j,i = 0,k;
  7. while(str[a] != '\0')
  8. a++;
  9. while(str[i] != '\0')
  10. {
  11. j = i+1;
  12. while(str[j] != '\0')
  13. {
  14. if(str[i] == str[j])
  15. {
  16. k = j;
  17. while(str[k] != '\0')
  18. {
  19. str[k] = str[k+1];
  20. k++;
  21. }
  22. a--;
  23. }
  24. else
  25. j++;
  26. }
  27. printf("%s",str);
  28. }
  29. int main() {
  30. //code
  31. int a;
  32. scanf("%d",&a);
  33. for(int i = 0;i<a;i++)
  34. {
  35. char str[i][];
  36. scanf("%s",str[i]);
  37. RemoveDuplicates(str);
  38. }
  39. return 0;
  40. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
2
geeksforgeek
acaaabbbacdddd
compilation info
prog.c: In function 'RemoveDuplicates':
prog.c:29:5: warning: 'main' is normally a non-static function [-Wmain]
 int main() {
     ^
prog.c: In function 'main':
prog.c:35:11: error: array type has incomplete element type 'char[]'
      char str[i][];
           ^
prog.c:35:11: warning: unused variable 'str' [-Wunused-variable]
prog.c: In function 'RemoveDuplicates':
prog.c:40:1: error: expected declaration or statement at end of input
 }
 ^
stdout
Standard output is empty