Recursion can be used to do both tasks in one line. Below are one line implementations for stracat() and strcmp().
The function my_strcmp() is simple compared to my_strcmp().
The above functions do very basic string concatenation and string comparison. These functions do not provide same functionality as standard library functions.
Please write comments if you find the above code incorrect, or find better ways to solve the same problem.
- Different methods to reverse a string in C/C++
- What's difference between char s and char *s in C?
- Variable Length Arrays in C and C++
- How to pass a 2D array as a parameter in C?
- How to dynamically allocate a 2D array in C?
- Difference between pointer and array in C?
- Memory Layout of C Programs
- Are array members deeply copied?
- What is the difference between single quoted and double quoted declaration of char array?
- Initialization of a multidimensional arrays in C/C++
- A nested loop puzzle
- Do not use sizeof for array parameters
- gets() is risky to use!
- C function to Swap strings
- Storage for Strings in C