Question: Write a C program to convert a string from upper - case characters to lower - case characters. Use the library function strlen ( )
Write a C program to convert a string from uppercase characters to lowercase characters. Use the library function strlen to iterate through all characters of the string. Since strings in C are nullterminated character sequences, strlen can only determine the length of a string by stepping through the sequence until it hits a null character. Use the clock function to measure program performance.
Define string as: char strTO MAXIMISE SYSTEM PERFORMANCE OF A PROGRAM, BOTH THE PROGRAMMER AND COMPILER REQUIRE A MODEL OF THE TARGET MACHINE SPECIFYING HOW INSTRUCTIONS ARE PROCESSED AND THE TIMING CHARACTERISTICS OF DIFFERENT OPERATIONS. FOR EXAMPLE, THE COMPILER MUST KNOW THE TIMING INFORMATION TO BE ABLE TO DECIDE WHETHER IT SHOULD USE MULTIPLICATION OR A SERIES OF ADDITION AND SHIFT OPERATIONS."
Repeat the above for double, triple, and quadruple string lengths
Can this code be optimized? What is the optimization method called?
Plot the string length vs time for both the normal and O optimization level with the gcc compiler. Comment on the results and nature of the graph.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
