Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C program to extract Web addresses starting with www. and ending with .edu. The program displays Web address contained in the input entered

Write a C program to extract Web addresses starting with www. and ending with .edu. The program displays Web address contained in the input entered by the user. If the input does not contain a web address that starts with www. and ends with .edu, the program should display a message that indicates such a web address cannot be found.

Input: http://www.usf.edu/admission

Output: www.usf.edu

Input: https://www.facebook.com/

Output: Web address starting with www. and ending with .edu not found Your program should include the following function: void extract(char *s1, char *s2); The function expects s1 to point to a string containing the input as a string and stores the output to the string pointed by s2.

1) Name your program extract.c.

2) Assume input is no longer than 1000 characters. Assume the input contains no more than one qualifying web address.

3) The extract function should use pointer arithmetic (instead of array subscripting). In other words, eliminate the loop index variables and all use of the [] operator in the function.

4) To read a line of text, use the read_line function (the pointer version) in the -down-

int read_line(char *str, int n) {

int ch, i = 0;

while ((ch = getchar()) != ' ')

{

if (i < n)

{

*str++= ch;

i++;}

}*str = '\0'; /* terminates string */

return i; /* number of characters stored */

}

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_2

Step: 3

blur-text-image_3

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

Database Processing

Authors: David J. Auer David M. Kroenke

13th Edition

B01366W6DS, 978-0133058352

More Books

Students also viewed these Databases questions

Question

What does it mean to crash the schedule?

Answered: 1 week ago

Question

How many Tables Will Base HCMSs typically have? Why?

Answered: 1 week ago

Question

What is the process of normalization?

Answered: 1 week ago