Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<string.h>
- #include<ctype.h>
- #include<stdlib.h>
- typedef struct
- {
- unsigned argc;
- char *args;
- }func_t;
- func_t concat( func_t s1 ,char s[])
- {
- s1.args=realloc(s1.args, s1.argc+strlen(s));
- strcpy(s1.args+s1.argc,s);
- s1.argc=strlen(s1.args);
- return s1;
- }
- int main(void)
- {
- char s[20]="Gummybear";
- func_t s1={0, NULL};
- s1=concat(s1,s);
- printf("%s \n",s1.args);
- s1=concat(s1,"SSS");
- printf("%s \n",s1.args);
- putchar('\n');
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement