hello everyone...
i have this class assignment and i need to convert my functions that use arrays to functions that use pointers that do the same thing...
here is one part of the code that needs to be converted...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
void strcat(char t[], const char s[])
{
unsigned int i;
for (i = 0; t[i]; i++);
strcpy(t+i, s);
}
/*
void strcatPT(char *t, const char *s)
{
unsigned int i;
for(i = 0; i
*/
|
you can see where i commented out the code that i was trying but got stuck on the for loop...
this is the 2nd part that i need help with...
Give the pointer version of the function strcmp(). This function returns 0, if the two char-arrays are equal (the same); a negative number, if target is < than source; and a positive number, if the target is > source. Here are some example:
strcmp("abc", "abc") returns 0
strcmp("abc", "abe") returns -2
strcmp("abcdefg", "abe") returns -2
strcmp("ab", "aaa") returns 1
strcmp("abcd", "abc") returns 100
strcmp("abc", "abcd") returns -100
now i don't want anyone to do the entire code for me otherwise i will never learn but maybe someone can help start me in the right direction. i thank you all for your time and consideration
thank you all again!