Contents

Develop
2015.10.13 16:11

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

조회 수 803 댓글 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
번호 분류 제목 글쓴이 날짜 조회 수
1005 Develop [ios] GPS 이용 상태 확인 hooni 2015.04.27 1293
1004 Develop [js] URL 파싱하기 (jQuery 안쓰고) hooni 2017.12.14 1302
1003 System/OS [mac] Mac OS 패키지 매니저, HomeBrew file hooni 2015.01.03 1307
1002 PPT [ppt] 전자금융보안론 발표/설치 자료 file hooni 2016.05.03 1311
1001 Develop [php] 한글 문자열 자르기 (utf-8) hooni 2015.11.10 1315
1000 Develop [android] 간단한 SQLIite 예제 hooni 2017.06.14 1317
999 Develop How to Test SMTP AUTH using Telnet hooni 2018.04.05 1330
998 System/OS RPA란? 어디에 어떻게 쓰이고 누가 만드나? file hooni 2020.01.28 1351
997 Develop [ios] How to set up clang formatter hooni 2015.09.17 1353
996 Develop [swift] popToRoot 모달뷰, 네비게이션컨트롤러 한꺼번에 닫기 file hooni 2021.01.29 1377
995 System/OS SSH Passwordless Login Using SSH Keygen in 5 Easy Steps file hooni 2019.11.22 1384
994 Develop [ios] Swift 4 String, Date, DateFormatter 예제 hooni 2018.10.18 1390
Board Pagination Prev 1 ... 10 11 12 13 14 15 16 17 18 19 ... 98 Next
/ 98