C How To Program, Global Edition
C How To Program, Global Edition
8th Edition
ISBN: 9781292110974
Author: Paul 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
Question 4: (Find the minimum value in an array) Write a program that include arecursive function “recursiveMinimum” that takes an integer array and the array size asarguments and returns the smallest element of the array. The function should stopprocessing and return when it receives an array of one element.
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.
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