Click here to Skip to main content
15,299,255 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: 25 years of programming reduced to a question. Pin
mdblack9824-Sep-20 2:30
Membermdblack9824-Sep-20 2:30 
GeneralRe: 25 years of programming reduced to a question. Pin
Stefan_Lang24-Sep-20 2:45
mveStefan_Lang24-Sep-20 2:45 
GeneralRe: 25 years of programming reduced to a question. Pin
Jeremy Falcon24-Sep-20 6:47
professionalJeremy Falcon24-Sep-20 6:47 
GeneralRe: 25 years of programming reduced to a question. Pin
NightPen24-Sep-20 3:39
MemberNightPen24-Sep-20 3:39 
GeneralRe: 25 years of programming reduced to a question. Pin
raddevus24-Sep-20 6:11
mvaraddevus24-Sep-20 6:11 
GeneralRe: 25 years of programming reduced to a question. Pin
Jeremy Falcon24-Sep-20 7:19
professionalJeremy Falcon24-Sep-20 7:19 
GeneralRe: 25 years of programming reduced to a question. Pin
Jeremy Falcon24-Sep-20 7:09
professionalJeremy Falcon24-Sep-20 7:09 
GeneralRe: 25 years of programming reduced to a question. Pin
Martin ISDN24-Sep-20 4:10
MemberMartin ISDN24-Sep-20 4:10 
the best i could get is a one liner on the same idea as @raddevus.
data = [1, 9, 8, 4, 0, 0, 2, 7, 0, 6, 0];
for (var i = data.length - 2; i >= 0; i--) data.splice(i, !data[i]).length && data.push(0);
all thanks to JavaScript.

i could have never thought of the solution you found on the internet. it's brilliant.

let's C
int d[] = {1, 9, 8, 4, 0, 0, 2, 7, 0, 6, 0}, *s = d + sizeof d / sizeof *d;
for (int *c = d, *l = d; c < s; c++) if (*c) *l ? *l++ : (*l++ = *c) && (*c = 0);

GeneralRe: 25 years of programming reduced to a question. Pin
raddevus24-Sep-20 6:06
mvaraddevus24-Sep-20 6:06 
GeneralRe: 25 years of programming reduced to a question. Pin
Jeremy Falcon24-Sep-20 7:22
professionalJeremy Falcon24-Sep-20 7:22 
GeneralRe: 25 years of programming reduced to a question. Pin
raddevus24-Sep-20 7:39
mvaraddevus24-Sep-20 7:39 
GeneralRe: 25 years of programming reduced to a question. Pin
Jeremy Falcon24-Sep-20 7:42
professionalJeremy Falcon24-Sep-20 7:42 
GeneralRe: 25 years of programming reduced to a question. Pin
Jeremy Falcon24-Sep-20 7:20
professionalJeremy Falcon24-Sep-20 7:20 
GeneralRe: 25 years of programming reduced to a question. Pin
mrmike24-Sep-20 4:28
professionalmrmike24-Sep-20 4:28 
GeneralRe: 25 years of programming reduced to a question. Pin
Jeremy Falcon24-Sep-20 7:34
professionalJeremy Falcon24-Sep-20 7:34 
GeneralRe: 25 years of programming reduced to a question. Pin
kmoorevs24-Sep-20 5:39
Memberkmoorevs24-Sep-20 5:39 
GeneralRe: 25 years of programming reduced to a question. Pin
Jeremy Falcon24-Sep-20 7:37
professionalJeremy Falcon24-Sep-20 7:37 
GeneralRe: 25 years of programming reduced to a question. Pin
sgtobin24-Sep-20 6:00
Membersgtobin24-Sep-20 6:00 
GeneralRe: 25 years of programming reduced to a question. Pin
Jeremy Falcon24-Sep-20 7:38
professionalJeremy Falcon24-Sep-20 7:38 
GeneralRe: 25 years of programming reduced to a question. Pin
patbob24-Sep-20 6:20
Memberpatbob24-Sep-20 6:20 
GeneralRe: 25 years of programming reduced to a question. Pin
Jeremy Falcon24-Sep-20 7:41
professionalJeremy Falcon24-Sep-20 7:41 
GeneralRe: 25 years of programming reduced to a question. Pin
abmv24-Sep-20 7:57
professionalabmv24-Sep-20 7:57 
GeneralRe: 25 years of programming reduced to a question. Pin
SeattleC++24-Sep-20 8:15
MemberSeattleC++24-Sep-20 8:15 
GeneralRe: 25 years of programming reduced to a question. Pin
Jeremy Falcon24-Sep-20 8:38
professionalJeremy Falcon24-Sep-20 8:38 
GeneralRe: 25 years of programming reduced to a question. Pin
Jeremy Falcon24-Sep-20 8:43
professionalJeremy Falcon24-Sep-20 8:43 

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.


Straw Poll

On which operating systems are you writing code?
Let's see if things have changed since we last ran this. "writing code" meaning editing, building, and running the code on that OS.
  Results   77 votes