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 are Macros? What are its advantages and disadvantages?
which of the following shows the correct hierarchy of arithmetic operations in C a) (), **, * or/,+ or - b) (),**,*,/,+,- c) (),**,/,*,+,- d) (),/ or *,- or +
c programs are converted into machine language with the help of a) an interpreter b) a compiler c) an operatinf system d) none of the above
What are the different types of pointers used in c language?
Write an efficient algo and C code to shuffle a pack of cards.. this one was a feedback process until we came up with one with no extra storage.
Explain void pointer?
What's the best way of making my program efficient?
What are header files and explain what are its uses in c programming?
The program will first compute the tax you owe based on your income. User is prompted to enter income. Program will compute the total amount of tax owed based on the following: Income Tax 0 - $45,000 = 0.15 x income $45,001 - $90,000 = 6750 + 0.20 x (income – 45000) $90,001 - $140,000 = 15750 + 0.26 x (income – 90000) $140,001 - $200,000 = 28750 + 0.29 x (income – 140000) Greater than $200,000 = 46150 + 0.33 x (income – 200000) Dollar amounts should be in dollars and cents (float point numbers with two decimals shown). Tax is displayed on the screen.
Draw a diagram showing how the operating system relates to users, application programs, and the computer hardware ?
Explain what are compound statements?
Describe the order of precedence with regards to operators in C.
Explain built-in function?
Explain what are the advantages and disadvantages of a heap?
What is typedef struct in c?