Question: Please follow the instructions provided by the problem. Project 5, Program Design, c programming 1. (60 points) A hashtag is a word or phrase preceded

Please follow the instructions provided by the problem.

Project 5, Program Design, c programming

1. (60 points) A hashtag is a word or phrase preceded by a hash sign (#), used on social media websites and applications, especially Twitter, to identify messages on a specific topic. Hashtag ends at an invalid hashtag character (any character that is not a letter, digit, or underscore) or the end of the sentence. Write a program to check if a sentence entered by user contains a hashtag. If so, display the hashtag. If not, print a no hashtag message. If there are multiple hashtags in the input, display the first one.

Example input/output: Input: More than 130 students messaged us to win an exclusive pair of USF socks last week for #NationalSockDay

Output: NationalSockDay

Input: More than 130 students messaged us to win an exclusive pair of USF socks last week for NationalSockDay!

Output: No hashtag in the input

Input: More than 130 students messaged us to win an exclusive pair of #USF socks last week for #NationalSockDay!

Output: USF

Input: More than 130 students messaged us to win an exclusive pair of USF socks last week for #NationalSockDay!

Output: NationalSockDay

Your program should include the following function:

int find_hashtag(char *s1, char *s2);

The find_hashtag function expects s1 to point to a string containing the input as a string and stores the hashtag to the string pointed by s2. If the input does not contain a hashtag, s2 should contain an empty string. An empty string is a valid string with no characters except the null character. The function returns 1 if the input contains a hashtag, and returns 0 otherwise.

1) Name your program extract_hashtag.c.

2) Assume input is no longer than 1000 characters.

3) The find_hashtag 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) strtok and strtok_r functions are not allowed in this program.

5) Library function isalpha(), isdigit(), and isalnum() are allowed in this program.

6) To read a line of text, use the read_line function (the pointer version).

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!