Click here to Skip to main content
14,382,073 members

The Insider News

   

The Insider News is for breaking IT and Software development news. Post your news, your alerts and your inside scoops. This is an IT news-only forum - all off-topic, non-news posts will be removed. If you wish to ask a programming question please post it here.

Get The Daily Insider direct to your mailbox every day. Subscribe now!

 
GeneralRe: Microsoft says .NET Framework porting project is finished: If your API's not on the list, it's not getting in Pin
#realJSOP16-Oct-19 2:30
mve#realJSOP16-Oct-19 2:30 
GeneralRe: Microsoft says .NET Framework porting project is finished: If your API's not on the list, it's not getting in Pin
Dan Neely16-Oct-19 4:28
memberDan Neely16-Oct-19 4:28 
NewsMicrosoft to start nagging Windows 7 Pro users about January 2020 end of support deadline Pin
Kent Sharkey15-Oct-19 10:00
staffKent Sharkey15-Oct-19 10:00 
GeneralRe: Microsoft to start nagging Windows 7 Pro users about January 2020 end of support deadline Pin
Nelek15-Oct-19 22:16
protectorNelek15-Oct-19 22:16 
GeneralRe: Microsoft to start nagging Windows 7 Pro users about January 2020 end of support deadline Pin
#realJSOP16-Oct-19 2:32
mve#realJSOP16-Oct-19 2:32 
NewsOpenAI’s AI-powered robot learned how to solve a Rubik’s cube one-handed Pin
Kent Sharkey15-Oct-19 10:00
staffKent Sharkey15-Oct-19 10:00 
NewsThe lines of code that changed everything Pin
Kent Sharkey15-Oct-19 9:00
staffKent Sharkey15-Oct-19 9:00 
GeneralRe: The lines of code that changed everything Pin
#realJSOP16-Oct-19 3:04
mve#realJSOP16-Oct-19 3:04 
Kent Sharkey wrote:
Or is this about swapping the values of two variables without using a third?


For numeric types:
int i = 1;
int j = 2;
i = i + j;
j = i - j;
i = i - j


Also works for a mix of positive and negative numbers.

For characters:
char y = 'a';
char z = 'b';
y = (char)((int)y+(int)z);
z = (char)((int)y-(int)z);
y = (char)((int)y-(int)z);

You can use the same general approach with characters by casting them to int first. For strings:
string a = "Hello";
string b = "World";
a = a + b; 
b = a.Substring(0,a.Length - b.Length); 
a = a.Substring(b.Length);

".45 ACP - because shooting twice is just silly" - JSOP, 2010
-----
You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
-----
When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013


modified 16-Oct-19 15:10pm.

GeneralRe: The lines of code that changed everything Pin
Richard Deeming16-Oct-19 9:17
mveRichard Deeming16-Oct-19 9:17 
NewsResearchers find bug in Python script may have affected hundreds of studies Pin
Kent Sharkey15-Oct-19 8:30
staffKent Sharkey15-Oct-19 8:30 
GeneralRe: Researchers find bug in Python script may have affected hundreds of studies Pin
Dar Brett15-Oct-19 15:27
memberDar Brett15-Oct-19 15:27 
News2,500 more MS-DOS games playable at the archive Pin
Kent Sharkey14-Oct-19 12:15
staffKent Sharkey14-Oct-19 12:15 
GeneralRe: 2,500 more MS-DOS games playable at the archive Pin
Eddy Vluggen15-Oct-19 2:34
mveEddy Vluggen15-Oct-19 2:34 
NewsTop Microsoft exec says online privacy has reached 'a crisis point' Pin
Kent Sharkey14-Oct-19 12:00
staffKent Sharkey14-Oct-19 12:00 
GeneralRe: Top Microsoft exec says online privacy has reached 'a crisis point' Pin
Nelek15-Oct-19 1:18
protectorNelek15-Oct-19 1:18 
NewsSudo flaw lets Linux users run commands as root even when they're restricted Pin
Kent Sharkey14-Oct-19 11:45
staffKent Sharkey14-Oct-19 11:45 
GeneralRe: Sudo flaw lets Linux users run commands as root even when they're restricted Pin
TheGreatAndPowerfulOz14-Oct-19 13:23
memberTheGreatAndPowerfulOz14-Oct-19 13:23 
GeneralRe: Sudo flaw lets Linux users run commands as root even when they're restricted Pin
Kent Sharkey14-Oct-19 13:27
staffKent Sharkey14-Oct-19 13:27 
GeneralRe: Sudo flaw lets Linux users run commands as root even when they're restricted Pin
TheGreatAndPowerfulOz15-Oct-19 5:26
memberTheGreatAndPowerfulOz15-Oct-19 5:26 
GeneralRe: Sudo flaw lets Linux users run commands as root even when they're restricted Pin
Nelek15-Oct-19 1:21
protectorNelek15-Oct-19 1:21 
NewsHabitual tea drinking modulates brain efficiency Pin
Kent Sharkey14-Oct-19 11:30
staffKent Sharkey14-Oct-19 11:30 
GeneralRe: Habitual tea drinking modulates brain efficiency Pin
Nelek15-Oct-19 1:24
protectorNelek15-Oct-19 1:24 
NewsApple Safari browser may send your browsing data to Chinese company Tencent Pin
Kent Sharkey14-Oct-19 11:30
staffKent Sharkey14-Oct-19 11:30 
GeneralRe: Apple Safari browser may send your browsing data to Chinese company Tencent Pin
ZurdoDev14-Oct-19 12:08
professionalZurdoDev14-Oct-19 12:08 
GeneralRe: Apple Safari browser may send your browsing data to Chinese company Tencent Pin
Nelek15-Oct-19 1:26
protectorNelek15-Oct-19 1:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.