how to swap two nubers by using a function with pointers?
Answer Posted / reshma
void swap(int *a, int *b)
{
int tmp;
tmp=*a;
*a=*b;
*b=tmp;
}
or
void swap(int *a, int *b)
{
*a=*a^*b;
*b=*a^*b;
*a=*a^*b;
}
Is This Answer Correct ? | 10 Yes | 1 No |
Post New Answer View All Answers
What language is windows 1.0 written?
Can we use visual studio for c?
What is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?
How do you define a function?
Badboy is defined who has ALL the following properties: Does not have a girlfriend and is not married. He is not more than 23 years old. The middle name should be "Singh" The last name should have more than 4 characters. The character 'a' should appear in the last name at least two times. The name of one of his brothers should be "Ram" Write a method: boolean isBadBoy(boolean hasGirlFriend , boolean isMarried, int age , String middleName , String lastName , String[] brotherName); isHaveGirlFriend is true if the person has a girlfriend isMarried is true if the person is married age is the age of the person middleName is the middle name of the person lastName is the last name of the person brotherName is the array of the names of his brothers
What is identifiers in c with examples?
Do you know the difference between exit() and _exit() function in c?
Who invented b language?
What is the difference between text and binary modes?
How do you declare a variable that will hold string values?
we called a function and passed something do it we have always passed the "values" of variables to the called function. such functions calles are called a) calls by reference b) calls by value c) calls by zero d) none of the above
What are directives in c?
How do I get an accurate error status return from system on ms-dos?
What is difference between class and structure?
Explain how many levels deep can include files be nested?