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
Complete the check_character() function which has 2 parameters: A string, and a specified index. The function checks the character at the specified index of the string parameter, and returns a string based on the type of character at that location indicating if the character is a letter, digit, whitespace, or unknown character. Ex: The function calls below with the given arguments will return the following strings: check_character('happy birthday', 2) returns "Character 'p' is a letter"check_character('happy birthday', 5) returns "Character ' ' is a white space"check_character('happy birthday 2 you', 15) returns "Character '2' is a digit"check_character('happy birthday!', 14) returns "Character '!' is unknown"    use python please def check_character(word, index):    # Type your code here.  if __name__ == '__main__':     print(check_character('happy birthday', 2))    print(check_character('happy birthday', 5))    print(check_character('happy birthday 2 you', 15))…
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
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
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