void swap(int a,int b)
{
a=a+b;
b=a-b;
a=a-b;
}
in this code always gives the same result for all case
Answer Posted / moorthy
here a and b are local variable in function swap() where a
and b are swapped inside swap().so that swaping does not
affect variable in main().
| Is This Answer Correct ? | 12 Yes | 1 No |
Post New Answer View All Answers
What is the significance of scope resolution operator?
Is it better to use malloc() or calloc()?
will u please send me the placement papers to my mail???????????????????
Why calloc is better than malloc?
Which operators cannot be overloaded a) Sizeof b) .* c) :: d) all of the above
What is the use of pragma in embedded c?
Why isn't any of this standardized in c? Any real program has to do some of these things.
Can the sizeof operator be used to tell the size of an array passed to a function?
What is difference between constant pointer and constant variable?
what is the significance of static storage class specifier?
the factorial of non-negative integer n is written n! and is defined as follows: n!=n*(n-1)*(n-2)........1(for values of n greater than or equal to 1 and n!=1(for n=0) Perform the following 1.write a c program that reads a non-negative integer and computes and prints its factorial. 2. write a C program that estimates the value of the mathematical constant e by using the formula: e=1+1/!+1/2!+1/3!+.... 3. write a c program the computes the value ex by using the formula ex=1+x/1!+xsquare/2!+xcube/3!+....
What is use of bit field?
Create a structure to specify data on students as given below: Roll number, Name, Department, Course, and Year of joining. Assume that there are not more than 450 students in the collage. (a) Write a function to print the names of all students who joined in the last 3 years. (b) Write a function to print the data of a student whose roll numbers are divisible by 4.
Does sprintf put null character?
What is the difference between single charater constant and string constant?