Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // apple xcode
- // paulogp
- /* str_copy: copy one string to other (=strcpy) */
- #include <stdio.h>
- #define MAX_VECT_LENGTH 50
- char *str_copy (char *the_destiny, char *the_origin);
- char *str_copy (char *the_destiny, char *the_origin)
- {
- int i = 0;
- while ((the_destiny[i] = the_origin[i]))
- i++;
- return the_destiny;
- }
- int main (int argc, const char * argv[])
- {
- char the_vector_a[MAX_VECT_LENGTH];
- char the_vector_b[MAX_VECT_LENGTH];
- // get number
- printf("texto: ");
- fgets(the_vector_a, MAX_VECT_LENGTH, stdin);
- // calculus
- str_copy(the_vector_b, the_vector_a);
- printf ("copia: %s\n", the_vector_b);
- return (0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement