Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

prepare the following functions, consistent with the prototypes shown:
.
1) int strlen(char* s);
Given a string, return the number of characters in the string, NOT INCLUDING the null at the end.
.
2) char* strcpy(char* s1, char* s2);
The function will copy the string s2 into the string s1. Note the function returns the address of the string.
.
3) char* strcat(char* s1, char* s2);
The function concatenates the string s2 into the end of string s1. If s1 is "Hello " and s2 is "World" before, after calling strcat, s1 will be "Hello World"

Lab Assignment #8
LAB Assignment:
prepare main() functions to test and debug each function, using gets() and puts() for string input and output as follows:
.
A) To demonstrate strlen(), input your first name using gets() and use printf to print the string followed by the number of characters in the string. An input of "Ken" would print 3. Show this with 3 string input exs.
.
B) To demonstrate strcpy(), input your first name using gets(s1) and use strcpy() to copy it to a second string, s2 and print both strings with puts(). So an input of "Ken" would print: "string1 = Ken string2 = Ken".
.
C) To demonstrate strcat(), use gets() to input your first name, last name, and Red ID as three separate strings, print them out, one per line, concatenate the three strings, and then use puts() to print out Hello followed by your name and Red ID. If the three input strings entered are "Ken" "Arnold" and "876543210", then it should print:
.
Ken
Arnold
876543210
Hello Ken Arnold 87654321  

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M981212

Have any Question?


Related Questions in Computer Engineering

Candidate as pollster conducted a survey in which 450 out

Candidate A's pollster conducted a survey in which 450 out of 710 respondents indicated they would probably vote for Candidate A. Compute the confidence interval for the population.

Anz is offering a product that pays out 3000 quarterly from

ANZ is offering a product that pays out $3,000 quarterly from the end of Mar 2021 to the end of Dec 2030 with annual interest rate 6% compounded quarterly. (e.g. payment is made at the end of every March, June, September ...

Will anyone help me with this and give me the explain how

Will anyone help me with this and give me the explain how did you get the answer? No coding necessary. Give truth tables for each the following Boolean expressions. a) not (P and Q) b) (not P) and Q c) (not P) or (not Q) ...

Can someone help me with this java problem and explain the

Can someone help me with this Java problem and explain the parts please! Write a method "totalDays" that takes three integer arguments (number of weeks, number of days, number of hours) and returns the total real number ...

Select one of the discussion topics and respond begin your

Select one of the discussion topics and respond. Begin your response by indicating which question you chose. Discussion topics: Section 4.1 Would you prefer a class in which 10 percent get A's and everyone competes for g ...

Do you need computers or information and communication

Do you need computers or information and communication technologies to store, organize, and manage data in organizations? Explain how the present day organizations in a developed country like the USA store and manage the ...

Under the trade model with external economies of scale is

Under the trade model with external economies of scale, is it possible for a country to be worse off with trade than it would have been without trade? Justify your answer.

Recall that a floating-point number can be expressed as-1s

Recall that a floating-point number can be expressed as (-1) s (1 + f) 2 e where s, f and e are binary numbers. Recall that s is the sign indicator, f the mantissa (or fractional part), and e the exponent. Suppose the si ...

Suppose there are two links between a source and a

Suppose there are two links between a source and a destination. The first link has transmission rate 200 Mbps and the second link has transmission rate 15 Mbps. Assuming, that the only traffic in the network comes from t ...

Question suppose we have a system with frequency of

Question : Suppose we have a system with frequency of floating point operations = 35%. What should be the speedup of floating point operation in our design of the next CPU to achieve a desired overall system speedup in t ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As