Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- int main()
- {
- char **a=malloc(20*sizeof(char*));
- char s[500];
- for(int i=0;i<20;i++)
- {
- a[i]=malloc(21*sizeof(char));
- }
- fgets(s,500,stdin);
- char *tok=strtok(s," ");
- int i=0;
- while(tok != NULL && i<20)
- {
- strcpy(a[i],tok);
- i++;
- tok=strtok(NULL," ");
- }
- char temp[21];
- strcpy(temp,a[0]);
- strcpy(a[0],a[2]);
- strcpy(a[2],temp);
- int j=0;
- while(a[j]!= i){
- printf("%s ",a[i]);
- j++;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement