Question
Please write this functions in C code language Function 1 : int isNumber(char *c) Function should return 1 is the argument passed is a digit
Please write this functions in C code language
Function 1 :
int isNumber(char *c) Function should return 1 is the argument passed is a digit and zero otherwise. Please note the asci equivalents of numeric characters from an asci table.
Function 2 :
Given the following C function prototype that accepts two integer arguments. Complete the function and return 1 if a > b , return -1 if a < b and return 0 if a is equal to b. int compare(int a, int b)
Function 3 :
Given the following C function prototype which accepts an integer argument, complete the implementation of the function to return the number of 1s in the binary representation of the number passed. For example if the number is (011100011 ) then the function should return 5 as the number of 1s. Please remember that an integer is 32 bits long. int countOnes(int number)
Function 4:
Write a C language function to determine the hamming distance ( the number of different bits) between two characters passed as parameter. Please note that the function prototype is given below. int returnHammingDistance( char firstparameter, char secondparameter)
NOTE: (defining Hamming Distance) for function #4
The Hamming distance between two integers or strings is the number of positions at which the corresponding symbols differ. It is used in telecommunication to count the number of flipped bits in a fixed-length binary word as an estimate of error, and therefore is sometimes called the signal distance. Hamming distance is the count of minimum number of bits that need to be inverted in order to change one number into the other. Example: Hamming distance between the two numbers: 11110100 and 10100101 1 1 1 1 0 1 0 0 1 0 1 0 0 1 0 1 The highlighted 3 bits differ from each other in the given example, and thus, its hamming distance is 3.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started