C Programming Language
2nd Edition
ISBN: 9780131103627
Author: Brian W. Kernighan, Dennis M. Ritchie, Dennis Ritchie
Publisher: Prentice Hall
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 1, Problem 19E
Write a function reverse(s) that reverses the character string s. Use it to write a
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Write a function to reverse the characters of a given string.
Write a function called repeater(s1, s2, n) that given two strings s1 and
s2 and an integer n returns a string that starts with an underscore ('_'),
then s1 and s2 alternate n times, then ends with an underscore.
Please do not use loops.
Write a function that adds two digit-strings in base b, where 2 <= b <= 10. Each string may be as long as one million digits, and strings must be of equal length.
Return the sum in a string that uses the same number base.
Preferred: C++
Chapter 1 Solutions
C Programming Language
Ch. 1 - Run the hello, world program on your system....Ch. 1 - Prob. 2ECh. 1 - Modify the temperature conversion program to print...Ch. 1 - Write a program to print the corresponding Celsius...Ch. 1 - Prob. 5ECh. 1 - Prob. 6ECh. 1 - Write a program to print the value of EOF.Ch. 1 - Write a program to count blanks, tabs and...Ch. 1 - Write a program to copy its input to its output,...Ch. 1 - Write a program to copy its input to its output,...
Ch. 1 - Prob. 11ECh. 1 - Write a program that prints its input one word per...Ch. 1 - Write a program to print a histogram of the...Ch. 1 - Write a program to print a histogram of the...Ch. 1 - Rewrite the temperature conversion program of...Ch. 1 - Revise the main routine of the longest-line...Ch. 1 - Write a program to print all input lines that are...Ch. 1 - Write a program to remove trailing blanks and tabs...Ch. 1 - Write a function reverse(s) that reverses the...Ch. 1 - Write a program detab that replaces tabs in the...Ch. 1 - Write a program entab that replaces strings of...Ch. 1 - Write a program to fold long input lines into two...Ch. 1 - Prob. 23ECh. 1 - Write a program to check a C program for...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
A (n) _______operator determines if a specific relationship exists between two values.
Starting Out With Visual Basic (7th Edition)
Suppose the classes PartTimeEmployee and FullTimeEmployee inherited the properties of the class Employee. What ...
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
Give a statement that will close the stream toFile created for the previous two questions.
Java: An Introduction to Problem Solving and Programming (7th Edition)
List for advantages of SQL-invoked routines.
Modern Database Management (12th Edition)
Given that y=ax3+7, which of the following are correct Java statements for this equations? int y = (a x) x (...
Java How To Program (Early Objects)
What is the difference between a pretest loop and a posttest loop?
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
Knowledge Booster
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
- Write a function repeatPhrase(phrase, n), which prints the given phrase n times, alternating between lowercase and uppercase. Recall, that if a String is a string, then a.upper() is the uppercase of that string, and a.lower() is the lower case of the string. For example, repeat('The sky is yellow', 5) would print: the sky is yellowTHE SKY IS YELLOW the sky is yellowTHE SKY IS YELLOW the sky is yellowarrow_forwardwrite a function in python that takes in a binary string, and returns it's two compliment in 32 bitsarrow_forwardWrite a function to read a string from user and in output print the sum of ASCII values of all lowercase alphabets in the string.Language: C++arrow_forward
- Write a Python function that takes a sequence of characters and determines if there are any pairs of characters that are not adjacent to each other by returning True if there are any pairs, or False Example: The string “abbot” would return False because the two b’s are adjacent to each other while the string “abba” would return True because, even though the two b’s are adjacent to each other, the two a’s are not.arrow_forwardWrite a function is_mirror(s) that takes as input a string s and returns True if s is a mirrored string (i.e., a string that could have been produced by your mirror function) and False otherwise. Examples:>>> is_mirror('baconnocab')True>>> print(is_mirror('baconnoca'))Falsearrow_forwardWrite a value-returning function, isVowel, that returns the value true if a given character is a vowel and otherwise returns false. For the input E, your output should look like the following: E is a vowel: 1arrow_forward
- Write a C function (only a function) that takes a string of any size (size > 3) as a parameter and prints the string after changing all 'a's to 'e's (e.g. if the string is "ahmad" then your function should print "ehmed" to the screen).arrow_forwardWrite a function called reverse that takes a parameter N which is a string and returns the reverse of the string.arrow_forwardHow to write a function in python that takes a string s = kkeeepinng and returns the non-repeating character from strrint s. Such that the output should be as follows: p i garrow_forward
- Write a function that takes in input as a string. For all characters which are numeric, double its value and, if it istwo digits, then replace it with the sum of its digits (e.g., 6 12 3 whereas 3 6). For all characters which arein uppercase, replace it with lowercase. For all characters which are in lowercase, replace it with (e.g.,m M and N n). The program should keep asking the user to enter strings until they either enter 'q' orarrow_forwardWrite a function that keeps computing the sum of the digits of x^n, until there is only one digit left. For example, sumOfDigits(2,5) returns 5, because 2 ^ 5 = 32 = 3 + 2 = 5 Another example, sumOfDigits(2,8) returns 4, because 2 ^ 8 = 128 = 1 + 2 + 8 = 13 = 1 + 3 = 4arrow_forwardWrite a function to find out longest palindrome in a given string?arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Computer Programming for Beginners | Functions, Parameters & Arguments | Ep24; Author: Programming With Avelx;https://www.youtube.com/watch?v=VXlh-qJpfw0;License: Standard YouTube License, CC-BY