Programming in C
Programming in C
4th Edition
ISBN: 9780321776419
Author: Stephen G. Kochan
Publisher: Addison-Wesley
bartleby

Videos

Textbook Question
Book Icon
Chapter 9, Problem 4E

Write a function called s to extract a portion of a character string. The function should be called as follows:

s

where S is the character string from which you are extracting the substring, S is an index number into S indicating the first character of the S, c is the number of characters to be extracted from the S string, and r is an array of characters that is to contain the extracted substring.

For example, the call

s

extracts the substring̎ (three characters starting with character number 4) from the string̎ and places the result in r.

Be certain the function inserts a null character at the end of the substring in the result array. Also, have the function check that the requested number of characters does, in fact, exist m the string. If this is not the case, have the function end the substring when it reaches the end of the source string. So, for example, a call such as

s

should just place the string “words” inside the result array, even though 20 characters were requested by the call.

Blurred answer
Students have asked these similar questions
In C programming language Question (Strings) Write a function find_Substring() that finds a substring into a string. Pass array s1 and s2 to this function and prints if the substring is present or not.   Expected Output 1: Enter string This is a javascript Enter substring script The substring is present Expected Output 2: Enter string This is a javascript Enter substring Jscript The substring is not present
Binary to String Create a function binary_to_ascii_string() that converts binary information into ASCII characters. This accepts a list of binaries, binary_values, and returns them as a string. (Note that the binary strings have 8 characters.) An example is present in the photo below. Thank you!
Write a function namedisInt that hasone parm, a stringand returnsanint. The function should return true (in the C sense) if the string contains an int (all characters in the string are digits) and return false (in the C sense) otherwise. USE POINTER NOTATION INSTEAD OF ARRAY NOTATION. NO BRACKETS.

Additional Engineering Textbook Solutions

Find more solutions based on key concepts
Assume as known that the Vandermonde determinant V=|11...1r1r2...r3r12r22...rn2r1n1r2n1...rnn1| is nonzero if t...

Differential Equations: Computing and Modeling (5th Edition), Edwards, Penney & Calvis

The ____________ is always transparent.

Web Development and Design Foundations with HTML5 (9th Edition) (What's New in Computer Science)

What is a parameterized constructor?

Starting out with Visual C# (4th Edition)

Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning
What Are Data Types?; Author: Jabrils;https://www.youtube.com/watch?v=A37-3lflh8I;License: Standard YouTube License, CC-BY
Data Types; Author: CS50;https://www.youtube.com/watch?v=Fc9htmvVZ9U;License: Standard Youtube License