Contents

Develop
2015.10.13 16:11

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

Views 953 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
793 Develop [lego] 세그웨이 이것만 볼것.. ㅎㅎ file hooni 2013.04.23 33574
792 Develop [c] C로 구현한 CGI - 방명록 file hooni 2003.04.23 33504
791 Develop 베지어 곡선(Bézier curve) 알고리즘(spline 곡선) 3 file hooni 2013.04.23 33396
790 Develop [js] jQuery 코드 작성시 편리한 HTML 템플릿 hooni 2013.12.17 33112
789 Develop [c++] 웹폼(webform)전송과 http 파일 업로드 샘플 file hooni 2013.04.23 33106
788 Develop [ios] 디렉토리 하하하.. hooni 2013.04.23 32655
787 Develop [js] 키보드 아스키코드(ASCII) 코드보기 hooni 2003.04.23 32503
786 Develop [c] C로 구현한 CGI - 달력과 날짜계산기 file hooni 2003.04.23 32438
785 Develop [ios] 개발 기초 가이드 링크.. hooni 2013.04.23 31416
784 Develop [js] jQuery 관련 문서 ㅎㅎ file hooni 2013.04.23 31253
783 Develop [android] 디바이스(시뮬레이터) hosts 파일 수정하기 hooni 2013.04.23 31119
782 Develop 서기의 PHP 동영상 강의(싱싱해) hooni 2013.05.15 31042
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 71 Next
/ 71