C Programming Language
C Programming Language
2nd Edition
ISBN: 9780131103627
Author: Brian W. Kernighan, Dennis M. Ritchie, Dennis Ritchie
Publisher: Prentice Hall
Question
Book Icon
Chapter 2, Problem 5E
Program Plan Intro

Program Plan-

  • Initialize the header files and main() function.
  • Ask the user to enter the two strings.
  • To define the function any(char[], char[]) to find the position of string2 in string1.
  • Finally prints the position.

Summary Introduction- The program takes two input string and finds out the position of string2 in string1.

Program Description- The purpose of the program is to take two input strings namely string1 and string2 and print the position of string2 in string1 by using the fullowing function-

any(s1, s2).

Blurred answer
Students have asked these similar questions
Write a c++ program: NOTE: Pointers must be used to solve the following problem. 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. 5char alpha [27] = “ABCDEFGHIJKLMNOPQRSTUVWXYZ”;char *pAlpha = alpha; Display the password from the main()function.Write a function replaceVowels()with no return value to replace all the vowels (A, E, I, O, U) that have been selected with a symbol from the list ($ % @ # &). That is, A must be replaced by $, E replaced by %, I must be replaced by @, O replaced by #, and U must be replaced by &. The function receives the address of the first characters of the password string as parameter. Display the password again…
C Program Functions using Pointers Create a function modify that accepts an integer and divides the integer by 2 if it is even. If the integer is odd, add one and divide it by 2. The function does not return anything.  In the main function, write a program that asks for an integer input and call the modify function by passing in the reference of that variable as a parameter.   An initial code is provided for you. Just fill in the blanks. Input 1. One line containing an integer input Output Enter a number: 5 Before: 5 After: 3
Complete the following function using pass-by-reference: void findMax(int &max, int a) which assigns value ‘a’ to ‘max’ if a > max. Write a pseudo-code then implement a program in C language to find the maximum in a sequence of numbers using this function.
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