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>