Define a function SwapGrade() that takes two char parameters passed by pointer and swaps the values in the two parameter

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Define a function SwapGrade() that takes two char parameters passed by pointer and swaps the values in the two parameter

Post by answerhappygod »

Define a function SwapGrade() that takes two char parameterspassed by pointer and swaps the values in the two parameters. Thefunction does not return any value.
Ex: If the input is A B, then the output is:
B A
#include <stdio.h>
/* Your code goes here */
int main(void) { char grade1; char grade2;
scanf(" %c", &grade1); scanf(" %c", &grade2);
SwapGrade(&grade1, &grade2);
printf("%c %c\n", grade1, grade2); return 0;}
in c please
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply