Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use C to finish the function #define MAX GREETING This program has two arguments: the first is a greeting message, and the second is a

Use C to finish the function image text in transcribed
#define MAX GREETING This program has two arguments: the first is a greeting message, and the second is a name. The message is an impersonal greeting, such as "Hi" or "Good morning". name is set to refer to a string holding a friend's name, such as "Emmanuel" or "Xiao", First copy the first argument to the array greeting. (Make sure it is properly null-terminated.) Write code to personalize the greeting string by appending a space and then the string pointed to by name. So, in the first example, greeting should be set to "Hi Emmanuel", and in the second it should be "Good morning Xiao". If there is not enough space in greeting, the resulting greeting should be truncated, but still needs to hold a proper string with a null terminator. For example, "Good morning" and "Emmanuel" should result in greeting having the value "Good morning Emmanu". int main(int argc, char xkargv) if (argc != 3) { fprintf(stderr, "Usage: greeting message name "); exit(1); char greeting [20]; char *name = argv[2]; // Your code goes here printf("%s ", greeting); 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

Advances In Databases And Information Systems 14th East European Conference Adbis 2010 Novi Sad Serbia September 2010 Proceedings Lncs 6295

Authors: Barbara Catania ,Mirjana Ivanovic ,Bernhard Thalheim

2010th Edition

3642155758, 978-3642155758

More Books

Students also viewed these Databases questions

Question

What is focal length? Explain with a diagram and give an example.

Answered: 1 week ago

Question

What is physics and how does it apply in daily life?

Answered: 1 week ago

Question

4. Design a career management system.

Answered: 1 week ago

Question

4. Evaluation is ongoing and used to improve the system.

Answered: 1 week ago

Question

6. Effectively perform the managers role in career management.

Answered: 1 week ago