DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Change Integer Variables Content

07.02.2005
| 4146 views |
  • submit to reddit
        
//+ Jonas Raoni Soares Silva
//@ http://jsfromhell.com

#include<stdio.h>
#include<conio.h>
void main(){
	int a, b;
	clrscr();

	printf( "Digite a= " );
	scanf( "%d", &a );

	printf( "Digite b= " );
	scanf( "%d", &b );

	a = b - a + ( b = a );

	printf( "a= %d\nb= %d", a, b);
	getch();
}

    

Comments

Snippets Manager replied on Thu, 2008/11/13 - 8:03am

Good, just 1 statement to exchange 2 variables. ^_^