Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <string.h>
- #include <stdio.h>
- char** StringToArray(char *sentence) {
- char** strs;
- int h = 0;
- int j=0;
- int k=0;
- while (j!=strlen(sentence)-1) {
- if (sentence[j] == ' ') {
- h++;
- k=0;
- }
- strs[h][k] = sentence[j];
- j++;
- k++;
- }
- return strs;
- }
- int main() {
- char** str = StringToArray("Ala ma kota");
- for (int i=0;i<3;i++) {
- for (int j=0;j<30;j++) {
- printf("%c", str[i][j]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement