1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
jeyben [28]
4 years ago
3

Use function GetUserInfo to get a user's information. If user enters 20 and Holly, sample program output is:Holly is 20 years ol

d. #include #include void GetUserInfo(int* userAge, char userName[]) { printf("Enter your age: \n"); scanf("%d", userAge); printf("Enter your name: \n"); scanf("%s", userName); return;}int main(void) { int userAge = 0; char userName[30] = ""; /* Your solution goes here */ printf("%s is %d years old.\n", userName, userAge); return 0;}
Computers and Technology
1 answer:
ehidna [41]4 years ago
8 0

Answer:

Replace

/*Your solution goes here*/

with

GetUserInfo(&userAge, userName);

And Modify:

printf("%s is %d years old.\n", userName, userAge)

to

printf("%s is %d years old.", &userName, userAge);

Explanation:

The written program declares userAge as pointer;

This means that the variable will be passed and returned as a pointer.

To pass the values, we make use of the following line:

GetUserInfo(&userAge, userName);

And to return the value back to main, we make use of the following line

printf("%s is %d years old.", &userName, userAge);

The & in front of &userAge shows that the variable is declared, passed and returned as pointer.

The full program is as follows:

<em>#include <stdio.h></em>

<em>#include <string.h></em>

<em>void GetUserInfo(int* userAge, char userName[]) { </em>

<em>    printf("Enter your age: "); </em>

<em>    scanf("%d", userAge); </em>

<em>    printf("Enter your name: "); </em>

<em>    scanf("%s", userName); </em>

<em>    return;</em>

<em>}</em>

<em>int main(void) { </em>

<em>    int* userAge = 0; </em>

<em>    char userName[30] = ""; </em>

<em>    GetUserInfo(&userAge, userName);</em>

<em>    printf("%s is %d years old.", &userName, userAge); </em>

<em>    return 0;   </em>

<em>}</em>

You might be interested in
The World Wide Web is a program that allows you to search for information on the Internet.
photoshop1234 [79]

Yes this is true. It also helps us to keep in touch with our loved ones, etc.

6 0
3 years ago
Please help with this
dolphi86 [110]

Answer:

Horizontal lines chart/graph

8 0
3 years ago
How do i add a header or footer to powerpoint presentation
BartSMP [9]
When you have you presentation open, go to Insert > Header & Footer.

7 0
4 years ago
In general, the outside _____ and sleeves of the isolation gown and outside front of the goggles, mask, respirator and face shie
diamong [38]
The answer to this question is the letter "A" which is TIES. In general, the outside TIES and sleeves of the isolation gown and outside the front of the goggles, mask, respirator and face shield are considered "contaminated" regardless of whether there is visible soil.
7 0
3 years ago
Read 2 more answers
Your help will help me understand my answers by comparing to yours. Your kind contribution is very much appreciated.
OLEGan [10]
4. B
for # 5 what illustration are u talking about
6. D
7. D
8. don't understand that question

sorry these questions might be wrong

6 0
3 years ago
Other questions:
  • You are going to buy a computer but first you want to do some research to help you select the best model everfi answer
    11·1 answer
  • Can someone explain a cylinder
    7·1 answer
  • Who were the big players in the yellow journalism movement?
    7·1 answer
  • Your boss wants you to devise a way for remote contractors to be able to access the server desktop. There is one stipulation, ho
    12·1 answer
  • A DBMS makes the: a. relational database available for different analytical views. b. physical database available for different
    12·1 answer
  • Visual-verbal synergy has nothing to do with text, but solely with images used in a design.
    9·1 answer
  • a. Create an Abstract class called Vehicle with abstract methods accelerate, stop, and gas, &amp; data of your choice (5 marks)
    12·1 answer
  • Pleases Help ME An example of a _________________ impact is when a product is back ordered and the business contacts the custome
    5·1 answer
  • What are some other features of sending attachments in Outlook 2016? Check all that apply.
    9·2 answers
  • Select the correct answer from each drop-down menu. The following diagram shows four resistors. What is the effective resistance
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!