Contents

Develop
2015.10.13 16:11

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

Views 810 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
1077 Develop [android] 코드에서 문자열로 Resource 가져오기 hooni 2015.07.09 3940
1076 Develop [android] 해상도 관련 팁 (dip -> pixel 변환) hooni 2013.04.23 15333
1075 Develop [android] 화면 전환(가로/세로)시 설정 hooni 2013.04.23 43372
1074 PPT [android][ios] 알림(Notification) 기능에 대한 원리와 구현 방안 (APNS포함) file hooni 2013.04.23 37851
1073 Develop [android]개발 가이드 및 한글화 문서 file hooni 2013.04.23 47516
1072 System/OS [apache2] Redirect HTTP to HTTPS file hooni 2022.02.03 686
1071 Develop [api] 인스타그램 API Access_Token 발급 방법 (Instagram API) 3 file hooni 2018.04.05 7565
1070 Develop [api] 인스타그램에서 최신 이미지 가져오기 (Using Instagram API) 20 file hooni 2018.04.05 12371
1069 Develop [asem] CMOS 패스워드 알아내기.. 소스.. file hooni 2003.04.23 8694
1068 Develop [asp] 기본 문법과 제어문 hooni 2013.04.23 7076
1067 Develop [asp] 문자열 관련 함수 요약 hooni 2013.04.23 7780
1066 Develop [asp] 문자열 넘겨받기 (get,post) hooni 2013.04.23 8680
Board Pagination Prev 1 ... 4 5 6 7 8 9 10 11 12 13 ... 98 Next
/ 98