Contents

Develop
2015.10.13 16:11

[c] 기막힌 정렬 코드 ㅋㄷ

Views 814 Comment 0
Atachment
Attachment '1'
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print

정말 기가 막히는 구나 ㅋㅋ;

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>

int main(int c, char **v)
{
    while(--c > 1 && !fork());
    sleep(c = atoi(v[c]));
    printf("%d\n", c);
    wait(0);
    return 0;
}

 

실행화면

sc.png


같은 코드를 JS 코드로 하면..

(function(arr){
    for(var i=0; i<arr.length; i++){
        var n=arr[i];
        setTimeout((function(n){
            return function(){
                console.log(n);
            }
        })(n), n);
    }
})([10, 1, 4, 2, 6, 3, 8, 5]);

 


?

List of Articles
No. Category Subject Author Date Views
49 Develop [ios] 비동기 블럭 코드 예제 hooni 2014.11.21 825
48 Develop [android] 초간단 얼럿 (AlertDialog) hooni 2016.10.21 815
» Develop [c] 기막힌 정렬 코드 ㅋㄷ file hooni 2015.10.13 814
46 Develop [js] e.stopPropagation() VS e.preventDefault () file hooni 2015.04.14 813
45 Develop [io] Apple Watch, Today Extension 앱ID 설정 hooni 2016.04.20 801
44 Develop [linux] CentOS Apache 웹서버에 HTTPS 적용 hooni 2015.10.23 790
43 Develop [Android Error] The number of method references in a .dex file cannot exceed 64K hooni 2016.11.10 760
42 Develop [c] 파일명 또는 특정 패턴을 적용 file hooni 2016.08.03 759
41 Develop 리팩토링 계획안 file hooni 2017.05.15 755
40 Develop [ios] 앱에서 설정화면 호출하기 hooni 2015.04.07 750
39 Develop [ios][swift] 초간단 TableView 샘플 file hooni 2016.06.27 746
38 Develop 캘리포니아 운전면허 족보 file hooni 2017.06.12 742
Board Pagination Prev 1 ... 62 63 64 65 66 67 68 69 70 71 Next
/ 71