Advertisement
Guest User

Untitled

a guest
Aug 11th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. #include <stdlib.h>
  2. #include <string.h>
  3. #include <stdio.h>
  4.  
  5. char** StringToArray(char *sentence) {
  6. char** strs;
  7. int h = 0;
  8. int j=0;
  9. int k=0;
  10. while (j!=strlen(sentence)-1) {
  11. if (sentence[j] == ' ') {
  12. h++;
  13. k=0;
  14. }
  15. strs[h][k] = sentence[j];
  16. j++;
  17. k++;
  18.  
  19. }
  20. return strs;
  21.  
  22. }
  23.  
  24.  
  25. int main() {
  26. char** str = StringToArray("Ala ma kota");
  27. for (int i=0;i<3;i++) {
  28. for (int j=0;j<30;j++) {
  29. printf("%c", str[i][j]);
  30. }
  31. }
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement