Question: 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

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!