Contents

Develop
2015.10.13 16:11

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

조회 수 821 댓글 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
번호 분류 제목 글쓴이 날짜 조회 수
81 Develop [ios] URL 랜딩 속도(OpenURL 10초 정지되는) 이슈 hooni 2015.02.09 860
80 Develop [android] AlertDialog 메시지 창 띄우기 hooni 2015.07.09 859
79 System/OS 개인적으로 쓰고 있는 bash_profile hooni 2015.01.16 858
78 Develop [ios] NSString, RegularExpression Find/Replace hooni 2017.04.14 854
77 Develop [c] 이진 탐색 두 가지 코드 (재귀/반복) file hooni 2015.06.26 851
76 System/OS 개인적으로 쓰고 있는 zshrc 파일 hooni 2022.02.25 844
75 Develop [kotlin] 코틀린 안드로이드 앱 버전/빌드 정보 hooni 2020.12.15 844
74 Develop [ios] GMT Date와 Local Date 변환하기 hooni 2015.04.07 837
73 Database [mysql] MySQL 백업 및 복구 hooni 2019.11.22 832
72 Etc 사이버보안실무 수업 메모 hooni 2017.03.30 828
71 Develop [ios] 비동기 블럭 코드 예제 hooni 2014.11.21 828
70 Develop [android] 초간단 얼럿 (AlertDialog) hooni 2016.10.21 824
Board Pagination Prev 1 ... 87 88 89 90 91 92 93 94 95 96 ... 98 Next
/ 98