Question: Explain the differences between a character and a string. [2 marks) (b) A student wants to declare a string mystr and set its value to

 Explain the differences between a character and a string. [2 marks)

Explain the differences between a character and a string. [2 marks) (b) A student wants to declare a string mystr and set its value to melaka. He uses the following statement: char mystr - "melaka"; In your opinion, will this statement be successfully executed? Give your reason. [4 marks) (c) Write a statement to initialize a string strl to "Melaka Berwibawa 2018. [3 marks] (d) Given a partial code for the function convertstr()in Figure Q4(d), which is used to convert all the uppercase letters to lowercase letters, and vice-versa void convertStr (char *mystr) { int length; int i; // complete the code here! } Figure Q4(d) Complete the program code. [8 marks] (e) Based on Question 4(e) and Question 4(d), produce a complete C program which: Display the initial contents of the string stri, Convert all the uppercase letters to the lowercase letters, Convert all the lowercase letters to the uppercase letters, Display the modified contents of the stri. [8 marks)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!