adspace


Create a simple code fragment that will swap the values of two variables num1 and num2.

Answer Posted / Nandan Singh

In C, you can use a temporary variable to swap the values of two variables like so:n`n int temp = num1;n num1 = num2;n num2 = temp;n`

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the difference between null pointer and void pointer.

1165


Is int a keyword in c?

1067


What is the difference between union and anonymous union?

1413


what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;

2743


What is the general form of a C program?

1107


What are pointers? What are different types of pointers?

1276


What are compound statements?

1300


hi send me sample aptitude papers of cts?

2258


List at least 10 sorting methods indicating their average case complexity, worst case complexity and best case complexity.

2836


Can a function be forced to be inline? Also, give a comparison between inline function and the C macro?

1187


write a c program to find the sum of five entered numbers using an array named number

2265


hi folks i m approching for h1 b interview on monday 8th of august at montreal and i m having little problem in my approval notice abt my bithdate my employer has made a mistake while applying it is 12th january and istead of that he had done 18 the of january do any body have any solution for that if yes how can i prove my visa officer abt my real birthdate it urgent please let me know guys thaks dipesh patel

1947


How do you determine the length of a string value that was stored in a variable?

1209


what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;

2522


The % symbol has a special use in a printf statement. How would you place this character as part of the output on the screen?

1363