Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Write a function that takes an unsigned int as a parameter, and returns the number of one's in its binary representation. Assume for this

image text in transcribed
1. Write a function that takes an unsigned int as a parameter, and returns the number of one's in its binary representation. Assume for this question that an unsigned int contains 32 bits. (Hint: Use the bitwise-and operation to mask all but the right-most bit of the parameter, and use the right-shift operation to discard the right-most bit after you have tested it.) 2. Write a function compress) that takes a C-string as a parameter, and compresses it so that all the non-alphabetic characters have been removed and the remaining characters have been pushed towards the beginning of the string. For example, if your function is passed the C-string "This string is 2 odd!", it should change it to the C-string "Thisstringisodd" 3. In class we wrote an implementation of the standard library function atio) that converts a C-string that contains only digits (with an optional leading'-) to the int it represents. Write a function that converts an int to the C-string that represents it. Don't forget to handle the case of a negative value. Your function should have the tollowing prototype void itoa (int i, char sO); Assume that the array that is passed to the function is large enough to hold the C-string. 4. Write a function called substr) that determines if the second parameter of the function is a substring of the first parameter. Your function should return true if it is, and false otherwise. Your function should have the following prototype int substr (const char s], const char tO); Do not use any functions in string.h (p. 249) except strlenO

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Bioinformatics Databases And Systems

Authors: Stanley I. Letovsky

1st Edition

1475784058, 978-1475784053

More Books

Students also viewed these Databases questions

Question

=+10 Are school enrolments up? [yes or no]

Answered: 1 week ago

Question

Define procedural justice. How does that relate to unions?

Answered: 1 week ago