Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define DIM 3
- #define DIM_A 3
- #include <stdio.h>
- #include <stdlib.h>
- int main(){
- char *strings[] = {"uno","due","tre"};
- char buf[] = "tre:due:uno";
- int i;
- char *p;
- char *array[DIM];
- i = 0;
- p = strtok (buf,":");
- while (p != NULL)
- {
- array[i++] = p;
- p = strtok (NULL, "/");
- }
- for (i=0;i<DIM; ++i)
- printf("%s\n", array[i]);
- int j = 0;
- char cacca[strlen(buf)];
- for (i = 0; i< DIM_A ; i++){
- for (j = 0; j< DIM ; j++){
- if (strings[i] == array[j])
- if(i == DIM_A -1)
- strcat(cacca, array[i]);
- else{
- strcat(cacca, strcat (array[i],":"));
- }
- }
- }
- return cacca;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement