Write a program on swapping (100, 50)



Write a program on swapping (100, 50)..

Answer / Prem Kumar

"```n#include <stdio.h>nnvoid swap(int* a, int* b)n{n int temp = *a;n *a = *b;n *b = temp;n}nnint main()n{n int num1 = 100,n num2 = 50;n printf("Before swapping: num1 = %d, num2 = %d
", num1, num2);n swap(&num1, &num2);n printf("After swapping: num1 = %d, num2 = %d
", num1, num2);n return 0;n}n```"

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

can you change name of main()?how?

3 Answers   HCL, Siemens,


How can you dynamically allocate memory in C?

2 Answers  


How can I call system when parameters (filenames, etc.) Of the executed command arent known until run time?

1 Answers  


What functions are in conio h?

1 Answers  


Explain the ternary tree?

1 Answers  


What are the different pointer models in c?

4 Answers  


Is array name a pointer?

1 Answers  


What is declaration and definition in c?

1 Answers  


Write a program to print fibonacci series without using recursion?

1 Answers  


What is function pointer c?

1 Answers  


what is a headerfile?and what will be a program without it explain nan example?

6 Answers   Assurgent,


Does c have an equivalent to pascals with statement?

1 Answers  


Categories