C How To Program Plus Mylab Programming With Pearson Etext -- Access Card Package (8th Edition)
C How To Program Plus Mylab Programming With Pearson Etext -- Access Card Package (8th Edition)
8th Edition
ISBN: 9780134227023
Author: Paul J. Deitel; Harvey Deitel
Publisher: PEARSON
Question
Book Icon
Chapter 8, Problem 8.29E
Program Plan Intro

Program plan:

  1. str,cmpstr variablesare used for inputs
  2. int strcmparr(const char s1[], const char s2[]) function stores string array reference in two array variables and compare the strings character by character using index variable and return the difference between character values.
  3. int strcmpptr(const char *s1, const char *s2) stores string array reference in pointer variables and copy compare the strings character by character using pointer arithmetic and return the difference between character values.

Program description:

The main purpose of the program is to demonstrate the working of built-in string function strcmp() by writing the two versions of each function. One version uses the pointer arithmetic to compare the strings. Second version uses array index to compare 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
(Write a code in C++ Programming language)Use a vector to read 10 integer numbers, each of which is between 1 and 50. Begin with an empty vector and use its push_back function to add each unique value to the vector. As each number is read, validate it and store it in the array only if it is not a duplicate of a number already read. After reading all the values, display only the unique values that the user entered.
(GREATEST COMMON DIVISOR) The greatest common divisor of integers x and y is the largest integer that evenly divides into both x and y. Write and test a recursive function gcd that returns the greatest common divisor of x and y. The gcd of x and y is defined recursively as follows: If y is equal to 0, then gcd (x, y) is x; otherwise, gcd (x, y) is gcd (y, x % y), where % is the remainder operator.
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