Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Type the following program and run it. #include #include int main(void) { char name[80]; printf(Enter your full name : ); gets(name); printf( Your name is

  1. Type the following program and run it.

#include

#include

int main(void)

{

char name[80];

printf("Enter your full name : ");

gets(name);

printf(" Your name is %s ", name);

system(pause);

return (0);

}

  1. For the above program, what happens if you use scanf to enter the full name? Why?

  1. Modify the program to print your name using a function.

  1. Modify the program to count the number of characters in the name and display both the name and the number of characters. Do not count spaces as characters. The ASCII code for a space is 3210 or ' ' as a character. The program must have two separate functions to count the number of characters and to display the result.

  1. Modify the program to the strlen function in the string.h library rather than the character counting function. Note that the number of characters now includes spaces.

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

Advanced Database Systems For Integration Of Media And User Environments 98

Authors: Yahiko Kambayashi, Akifumi Makinouchi, Shunsuke Uemura, Katsumi Tanaka, Yoshifumi Masunaga

1st Edition

9810234368, 978-9810234362

More Books

Students also viewed these Databases questions

Question

What must a creditor do to become a secured party?

Answered: 1 week ago

Question

=+1 What would you do if you were the IHR manager?

Answered: 1 week ago