Please put in code and show output window, Please! Your task is to write a progr
ID: 665621 • Letter: P
Question
Please put in code and show output window, Please!
Your task is to write a program that has a function. It should have these general characteristics:
The program should not be longer than 30 lines. This should be a small task, nothing fancy.
The program must contain a function.
The task of the function is to be passed in a minimum of two variables and to change their value within the function.
The main program will declare the variables (not global variables) and initialize them to some starting value, call the function, and print out the values of the variables after the function.
You will need to have a prototype of the function.
The variables can be char, int, or float.
Thank you,
need help bad
Explanation / Answer
please rate - thanks
you weren't very specific
#include<stdio.h>
#include <conio.h>
void changeValues(int*,float*,char*);
int main()
{int n=5;
float a=4.5;
char c='c';
printf("before n=%d, a=%.2f, c=%c ",n,a,c);
changeValues(&n,&a,&c);
printf("after n=%d, a=%.2f, c=%c ",n,a,c);
getch();
return 0;
}
void changeValues(int* n,float* a,char* c)
{*n=*n+1;
*a=*a+1;
*c=*c+1;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.