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.30E
Program Plan Intro

Program plan:

  1. str variableis used for input.
  2. int strlenarr(const char s[]) function stores string array reference in one array variableand return the length of the passing string.
  3. int strlenptr(const char *s)stores string array reference in pointer variable andreturn the length of the passing string.

Program description:

The main purpose of the program is to demonstrate the working of built-in string function strlen() 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
USE C++ (Display matrix of 0s and 1s) Write a function that displays an n-by-n matrix using the following header: void printMatrix(int n) Each element is 0 or 1, which is generated randomly. Write a test program that prompts the user to enter n and displays an n-by-n matrix. Here is a sample run:
(Check test scores) The answers to a true-false test are as follows: T T F F T. Given a two-dimensional answer array, in which each row corresponds to the answers provided on one test, write a function that accepts the two-dimensional array and number of tests as parameters and returns a one-dimensional array containing the grades for each test. (Each question is worth 5 points so that the maximum possible grade is 25.) Test your function with the following data: int score = 0;
(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.
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