Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

Give me answer fast?????

0 votes
asked Nov 14, 2019 by anonymous
Define a method void Swap(char  ch1,char ch2) to interchange the values of arguments ch1 and ch2 . Also, print the characters.

1 Answer

0 votes
answered Nov 15, 2019 by rohan ag (1,310 points)
#include <stdio.h>
void Swap(char  *ch1,char *ch2)//we need to take pointer here then only you can able to swap the characters
{
*ch1=*ch1+*ch2-(*ch2=*ch1);
}

int main()
{
    char ch1,ch2;
    printf("enter any two characters");
    scanf("%c %c",&ch1,&ch2);
    Swap(&ch1,&ch2);
    printf("%c,%c\n",ch1,ch2);
        printf("%d,%d\n",ch1,ch2);
    
    

    return 0;
}
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...