C How to Program (8th Edition)
C How to Program (8th Edition)
8th Edition
ISBN: 9780133976892
Author: Paul J. Deitel, Harvey Deitel
Publisher: PEARSON
Question
Book Icon
Chapter 8, Problem 8.28E
Program Plan Intro

Program plan:

  1. str1,str2,str3,str4 variablesare used for inputs
  2. char *strcpyptr(char *dest, const char *src) function stores string array reference in pointer variables and copy srcto deststring using pointer arithmetic and return the copied string.
  3. char *strcpyarr(char dest[], const char src[]) function stores string array reference in two array variables and copy srcto deststring using array index and return the copied string.
  4. char *strcatarr(char src[], char dest[])) function stores string array reference in pointer variables and perform concatenation using srcanddeststrings using pointer arithmetic and return the resultant string.
  5. char *strcatptr(char *src, const char *dest) function stores string array reference in two array variables and perform concatenation using srcand dest using array index and return the resultant string.

Program description:

The main purpose of the program is to demonstrate the working of built-in string function strcat() and strcpy() by writing the two versions of each function. One version of each uses the pointer arithmetic to copy and concat the strings. Second version of each uses array index to copy and concat the strings.

Blurred answer
Students have asked these similar questions
.“Dangling and wild pointers are known to be problems with pointers”. Justify the given statement with the helpof suitable example
State whether the following are true or false. If the answer is false, explain why.b) Pointers of different types may not be assigned to one another without a cast operation.
(10) Question 2.2 NOTE: Pointers must be used to solve the following problem. You will 8 marks if pointers are not used, even if the solution is correct. Write a function createPassword() with no return value to randomly select 8 capital letters from the alphabet. The function receives the address of the first characters of the password string as parameter. Hint: Declare a characters string that contains all the capital letters of the alphabet and use the index values of the characters in the string for random selection of characters, e.g. 5 char alpha [27] = “ABCDEFGHIJKLMNOPQRSTUVWXYZ”; char *pAlpha = alpha;
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning