Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a function named checkMessages that accepts an array of pointers to C-strings (array of characters with NULL terminating character) and its size.

Write a function named "checkMessages" that accepts an array of pointers to C-strings (array of characters with NULL terminating character) and its size. It checks to see whether the array of messages that contains any message that begins or ends with '-' or has it in the middle of the array.

It will return the following three values: - the number of messages that begins with '-' - the number of messages that ends with '-' - the number of messages that begins and ends with '-'

Here is an example of test data and its expected return values int main() { char msg1[] = "One" ; char msg2[] = "-Two" ; char msg3[] = "-Three-" ; char msg4[] = "Fou-r" ; char msg5[] = "-Fiv-e" ; char * msgSet1[] = {msg1} ; // with this array, the function will return 0 begins, 0 ends and 0 both. char * msgSet2[] = {msg1, msg2} ; // with this array, the function will return 1 begin, 0 end 0 both char * msgSet3[] = {msg1, msg2, msg3} ; // with this array, the function will return 2 begins, 1 end and 1 both char * msgSet4[] = {msg1, msg2, msg3, msg4} ; // with this array, the function will return 2 begins, 1 end and 1 both char * msgSet5[] = {msg1, msg2, msg3, msg4, msg5} ; // with this array, the function will return 3 begins, 1 end and 1 both char * msgSet6[] = {msg3} ; // with this array, the function will return 1 begin, 1 end and 1 both return 0 ; }

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

Step: 3

blur-text-image

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

Intelligent Information And Database Systems Asian Conference Aciids 2012 Kaohsiung Taiwan March 2012 Proceedings Part 2 Lnai 7197

Authors: Jeng-Shyang Pan ,Shyi-Ming Chen ,Ngoc-Thanh Nguyen

2012th Edition

3642284892, 978-3642284892

More Books

Students also viewed these Databases questions

Question

why we face Listening Challenges?

Answered: 1 week ago

Question

what is Listening in Context?

Answered: 1 week ago