write a program in C to swap two variables
Answer Posted / srinivas
#include <stdio.h>
int main(void)
{
int a = 2, b = 5;
a = a + b;
b = a - b;
a = a - b;
printf("%d\t%d\n", a, b);
return 0;
}
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
Explain what is a 'locale'?
Explain about block scope in c?
struct screen_pos{ int row, col } ;move_right(cursor)struct screen_pos *cursor;{ cursor.col++; } /* This statementhas a syntax error */What is the correct statement a) cursor.col = cursor.col + 1; b) col.cursor++; c) *cursor.col++; d) pointer
What is #line in c?
What is #define?
Explain how can I convert a string to a number?
What are identifiers and keywords in c?
Is printf a keyword?
Write a program to replace n bits from the position p of the bit representation of an inputted character x with the one's complement. Method invertBit takes 3 parameters x as input character, p as position and n as the number of positions from p. Replace n bits from pth position in 8 bit character x. Then return the characters by inverting the bits.
Is Exception handling possible in c language?
1) There is a singing competition for children going to be conducted at a local club. Parents have been asked to arrive at least an hour before and register their children’s names with the Program Manager. Whenever a participant registers, the Program Manager has to position the name of the person in a list in alphabet order. Write a program to help the Program Manager do this by placing the name in the right place each time the Program Manger enters a name. The Logic should be written in Data Structures?
What is a method in c?
A global variable when referred to in another file is declared as this a) local variable b) external variable c) constant d) pointers
Which control loop is recommended if you have to execute set of statements for fixed number of times?
main() { int i = 10; printf(" %d %d %d ", ++i, i++, ++i); }