Advertisement
a3f

Split by case

a3f
Dec 9th, 2013
368
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.38 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. int n,m;
  4. int main ()
  5. {
  6. char string[] = "aBcdEf";
  7. char caps[10], smalls[10]; // 10, should be changed to the max size of string
  8.  
  9. for (int i = 0; i < strlen(string); ++i)
  10. {
  11.     if (string[i]>'Z')
  12.         smalls[n++] = string[i];
  13.     else
  14.         caps[m++] = string[i];
  15. }
  16. smalls[n] = caps[m] = '\0';
  17.  
  18. printf("%s :: %s :: %s", string, smalls, caps);
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement