hi all i am a new bee for ANSI C , can anyone solve the question for me please , so that i can understand each line of it wid puting time into it , i really want to get ANSI C in my head so kindly help me out .
cheers.
A function with the following prototype
Char *mystrcat(char *s, char *p);
The function appends string p to the end of string s and returns a pointer to the start of string s.
Remember that strings are terminated by binary zero (‘\0’).
Suppose string s contains “abcd” and string p contains “xyz”. The result would be string s containing “abcdxyz”.
Use the program section below to test your program:
#include <ctype.h>
char *mystrcat(char *s,char *p);
main()
{
Char string1[80], string2[80];
For ( ; ; )
{
Printf(“Enter string1: “);
Scanf(“%s”, &string1);
If (!strcmp(string 1, “done”))
Break;
Printf(“Enter string2: “);
Scanf(“%s”, &string2);
Printf(“String1 : %s String2: %s\n”, string1, string2);
Printf(“Returne d string : %s\n”, mystrcat(string 1,
string2);
Printf(“String1 : %s String2: %s\n”, string1, string2);
}
}
Hint : ctestchar = *(ptrstring++) – assigns the character pointer to by ptrstring to the character ctestchar and moves the pointer on by one character.
cheers.
A function with the following prototype
Char *mystrcat(char *s, char *p);
The function appends string p to the end of string s and returns a pointer to the start of string s.
Remember that strings are terminated by binary zero (‘\0’).
Suppose string s contains “abcd” and string p contains “xyz”. The result would be string s containing “abcdxyz”.
Use the program section below to test your program:
#include <ctype.h>
char *mystrcat(char *s,char *p);
main()
{
Char string1[80], string2[80];
For ( ; ; )
{
Printf(“Enter string1: “);
Scanf(“%s”, &string1);
If (!strcmp(string 1, “done”))
Break;
Printf(“Enter string2: “);
Scanf(“%s”, &string2);
Printf(“String1 : %s String2: %s\n”, string1, string2);
Printf(“Returne d string : %s\n”, mystrcat(string 1,
string2);
Printf(“String1 : %s String2: %s\n”, string1, string2);
}
}
Hint : ctestchar = *(ptrstring++) – assigns the character pointer to by ptrstring to the character ctestchar and moves the pointer on by one character.
Comment