Contents

Develop
2015.10.13 16:11

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

조회 수 828 댓글 0
Atachment
첨부 '1'
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

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

#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
번호 분류 제목 글쓴이 날짜 조회 수
1017 Develop [ios] UIWebView를 이용한 로컬 HTML 파일 표시 file hooni 2015.01.02 1247
1016 System/OS [linux] iptables 초간단 세팅 스크립트 hooni 2017.09.26 1254
1015 Develop [ios] APNS, Remote Push 사용자가 수신을 동의했는지 확인하기 hooni 2018.10.19 1273
1014 System/OS Configure Postfix to Use Gmail SMTP on Ubuntu 18.04 file hooni 2020.02.07 1273
1013 System/OS [linux] yum 업데이트 시 커널 제외하기 hooni 2014.09.11 1283
1012 Develop [android] How can I place app icon on launcher home screen? hooni 2016.11.15 1283
1011 PPT [ppt] Macro for board game 발표자료 (@Team Study 2013.01.18) 1 file hooni 2015.07.22 1286
1010 Develop [ios] 동영상 플레이어 샘플 (for PIP Player) file hooni 2017.03.15 1291
1009 System/OS How to Install and Use wget on Mac file hooni 2020.09.03 1305
1008 Develop [ios] GPS 이용 상태 확인 hooni 2015.04.27 1313
1007 Etc 모바일 프로그래머가 갖추어야 할 필수 역량 file hooni 2017.02.16 1317
1006 Develop [js] URL 파싱하기 (jQuery 안쓰고) hooni 2017.12.14 1325
Board Pagination Prev 1 ... 9 10 11 12 13 14 15 16 17 18 ... 98 Next
/ 98