Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<stdlib.h>
- char ** get_tokens() {
- //printf("get tokens...\n");
- char *s1 = "hello";
- char *s2 = "world!";
- char *s3 = "...char**";
- char *s4 = " is hard!";
- char **ch = (char **)malloc(4 * sizeof(char *));
- *ch = s1;
- *(ch+1) = s2;
- *(ch+2) = s3;
- *(ch+3) = s4;
- return ch;
- }
- int main() {
- char ** tokens = get_tokens();
- while(*tokens != NULL) {
- char *p = *tokens;
- printf("HERE: %s\n", p);
- tokens++;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement