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 2, Problem 10E
Rewrite the function lower, which converts upper case letters to lower case, with a conditional expression instead of if-else.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Write a function bool chkAge(int) which return true if age is above 18 else returns false.
In Oak language.
A function that turns an argument to a string (call it “toString(…)”) is a great use of function overloading. In one sentence, why might this be?
In one sentence, why should we generally verify the arguments are what we expect when writing a function?
Write the definition for a function switch that receives as parameters first_name and last_name and prints them in reverse order. Write the call to the function from main, passing two names as parameters.
Chapter 2 Solutions
C Programming Language
Ch. 2 - Prob. 1ECh. 2 - Write a loop equivalent to the for loop above...Ch. 2 - Write the function htoi(s), which converts a suing...Ch. 2 - Write an alternate version of squeeze(s1,s2) that...Ch. 2 - Prob. 5ECh. 2 - Prob. 6ECh. 2 - Prob. 7ECh. 2 - Prob. 8ECh. 2 - Prob. 9ECh. 2 - Rewrite the function lower, which converts upper...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Which of the following identifier forms is most readable? Support your decision. SumOfSales sum_of_sales SUMOFS...
Concepts of Programming Languages (11th Edition)
1. Read the problem statement. 2. Formulate the algorithm using pseudocode and top-down, stepwise refinement. 3...
Java How To Program (Early Objects)
Calculating the Factorial of a Number In mathematics, the notation n! represents the factorial of the nonnegati...
Starting Out with Python (4th Edition)
Explain the difference between the WHERE and HAVING clause.
Modern Database Management
Find the error in each of the following. (Note: There may be more than one error.) The following code should pr...
C How to Program (8th Edition)
For each of the following E-R diagrams from Chapter 2 C: Transform the diagram to a relational schema that show...
Modern Database Management (12th Edition)
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
- Create a function in C language that takes two integers x, and y as the parameters and returns the sum and the absolute difference of both the numbers but the return type of the function should be void. You can add extra parameters to the function but the function should not return anything and should send the required values as well. Test your function for the numbers 10, and 5 inside the main function.arrow_forwardTwo words are anagrams if they are formed by rearranging the letters of another, such as cinema, formed from iceman, and vice versa. Implement an anagram checker function using string functions in C. Your program should be able to: 1. Scan for the two words to be checked 2. Pass those two words to a function called areAnagrams which returns an int to be interpreted in the main() whether the given words are anagrams or not. 3. The program should loop indefinitely until the words "EXIT NOW" is used as input. Sample Run: Enter two strings: cinema iceman cinema and iceman are anagrams! Enter two strings: almost atoms almost and atoms are NOT anagrams Enter two strings: vice versa vice and versa are NOT anagrams! Enter two strings: frail flare frail and flare are NOT anagrams! Enter two strings: algorithm logarithm algorithm and logarithm are anagrams! Enter two strings: EXIT NOWarrow_forwardWrite a function subtract for the rational type which puts the result in simplest form. Write a function multiply for the rational type which puts the result in simplest form. Write a function divide for the rational type which puts the result in simplest form.arrow_forward
- Write a function fune/2 which has two arguments and returns true, if the two arguments are equal, and false, otherwise. For example, fune (2, two)==false.arrow_forwardWrite the definition of the string function named L() that takes no parameters and returns a string of a line of 10 asterisks.arrow_forwardAnswer all else I’ll downvotearrow_forward
- Answer q4arrow_forwardBartleby answered my homework and Write a function called has_duplicates that takes a string parameter and returns True if the string has any repeated characters. Otherwise, it should return False. Implement has_duplicates by creating a histogram using the histogram function above. Do not use any of the implementations of has_duplicates that are given in your textbook. Instead, your implementation should use the counts in the histogram to decide if there are any duplicates. Write a loop over the strings in the provided test_dups list. Print each string in the list and whether or not it has any duplicates based on the return value of has_duplicates for that string. For example, the output for "aaa" and "abc" would be the following. aaa has duplicatesabc has no duplicates Print a line like one of the above for each of the strings in test_dups. True needs to be defined. I tried to code it but didn't accept and got an error message.arrow_forwardWrite the function strend (s ,t ), which returns 1 if the string t occurs at the end of the string s, and zero otherwise.arrow_forward
- Write a function testString (str) that takes a single string parameter str. The function must compare its string argument with the string "Friday" to see if the two strings are the same and if so it must say "Thank goodness it's Friday!" in a message box; the function must also test to see if the string is equal to "Monday" and if so must return "Oh no - not Monday!" in a message box; if neither match is made your function must return the string "No match!" in a message box. The string argument must be fetched from a text control in the page and the comparison made by calling your function from a button onclick event-handler. JavaScript is case sensitive, so make sure that your function can make a successful test no matter how the user types the string "Friday" or "Monday" into the text control - see below. Qwerty Test Enter a string No match. OK Note that a test of equality is a logic operation; the logic operator is required for such a test.arrow_forwardWrite a function that takes two integers and returns True if the integers have a common divisor that is different than 1, otherwise returns False. For example, notRelPrime(3,5) returns False, whereas notRelPrime (8,12) returns True. Because, 3 and 5 have only one common divisor, which is 1, whereas 8 and 12 are both divisible by 1, 2 and 4. def notRelPrime (a, b):arrow_forwardWrite a function in C progarmming language that gets a string str, changes all lower case letters to * (asterisk), and all upper case letters to $ (dollar sign). All other characters remain unchanged. The function returns the total number of letters modified. int hide_letters(char* str); For example: - If str is "12ab0", then the function changes it to "12**0", and returns 2. - If str is "aBCDe*", then the function changes it to "*$$$**", and returns 5. - If str is "0123&***", then the function keeps the string as is, and returns 0. - An empty string is also a string.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
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