Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What are Macros? What are its advantages and disadvantages?

1094


which of the following shows the correct hierarchy of arithmetic operations in C a) (), **, * or/,+ or - b) (),**,*,/,+,- c) (),**,/,*,+,- d) (),/ or *,- or +

1675


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

1208


What are the different types of pointers used in c language?

997


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.

1019


Explain void pointer?

977


What's the best way of making my program efficient?

1041


What are header files and explain what are its uses in c programming?

1070


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.

1574


Draw a diagram showing how the operating system relates to users, application programs, and the computer hardware ?

2524


Explain what are compound statements?

997


Describe the order of precedence with regards to operators in C.

1006


Explain built-in function?

1093


Explain what are the advantages and disadvantages of a heap?

1037


What is typedef struct in c?

1003