Contents

Develop
2015.10.13 16:11

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

조회 수 816 댓글 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
번호 분류 제목 글쓴이 날짜 조회 수
285 System/OS [mac] 컨텍스트(Context) 메뉴 "다음으로 열기" 내용 정리 hooni 2013.07.10 18798
284 System/OS [mac] 패키지 매니저, MacPort hooni 2015.01.03 980
283 System/OS [mac][추천 무료앱] 구름 입력기 - 국내 맥 사용자를 위한 한글 대안 입력기 1 file hooni 2015.01.04 2168
282 Develop [matlab] ZigZag-Scanning (2-D Array) file hooni 2016.10.15 1996
281 Develop [matlab] 정보은닉 스테가노그래피(Steganography) 수업 file hooni 2016.10.03 688
280 Develop [maven] Mac OS에 메이븐(maven) 설치하기 file hooni 2015.01.21 1112
279 System/OS [ms-sql] 서브스트링(substring), 프로시저(SP) 작성 예제 hooni 2013.04.23 41299
278 System/OS [ms-sql] 프로시져 예제.. file hooni 2013.04.23 13408
277 Database [mysql] CPU 점유율이 높을 때 확인할 내용 hooni 2015.08.26 6653
276 Database [mysql] DB->Text, Text->DB 변환 hooni 2003.04.23 12131
275 Database [mysql] ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement. hooni 2017.12.15 1214
274 Database [mysql] error while loading shared libraries: libmysqlclient.so.10: hooni 2003.04.23 12664
Board Pagination Prev 1 ... 70 71 72 73 74 75 76 77 78 79 ... 98 Next
/ 98