Develop
2015.10.13 16:11

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

Views 810 Votes 0 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
761 Develop [ios] Did UIScrollView End Scrolling? hooni 2016.04.19 1023
760 Develop [ios] 로컬에 있는 html 실행하기 hooni 2015.02.10 1032
759 Develop [ios] 최상위 ViewController 가져오기 hooni 2015.10.12 1062
758 Develop [ios][swift] 초간단 To-do Memo file hooni 2016.06.27 1066
757 Develop [ios] StoryBoard(xib) 없이 프로젝트 만들기 file hooni 2015.02.12 1069
756 Develop [ios] 동영상 플레이어 샘플 (for Local File) file hooni 2017.02.07 1075
755 Develop [ios] FlckrFeed Example App (Swift) file hooni 2016.11.27 1077
754 Develop [js] 문자열에서 숫자만 걸러내기 (jQuery 안쓰고 정규표현식) hooni 2017.12.14 1104
753 Develop [maven] Mac OS에 메이븐(maven) 설치하기 file hooni 2015.01.21 1108
752 Develop [ios] UIView 계층구조 hooni 2015.01.03 1126
751 Develop [coding] Find all anagrams in a string hooni 2017.06.27 1142
750 Develop macOS에 node, npm 설치하기 (homebrew) file hooni 2021.11.06 1145
749 Develop GPL, AGPL, MPL,.. 한눈에 보는 오픈소스SW 라이선스 file hooni 2014.10.14 1146
748 Develop [ios] Objective-C Types & Storage Capacity hooni 2015.07.22 1155
747 Develop [android] Calling activity function from separate class hooni 2016.11.15 1159
746 Develop [ios] Facebook SDK 로그인 설명 file hooni 2017.04.19 1161
Board Pagination Prev 1 4 5 6 7 8 ... 53 Next
/ 53