x

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define N 100

int main() 
{
    unsigned i;
    int head[N]={0}, test[N]={0};
    srand(0);
    for(i=0; i!=N; ++i) head[i] = rand();
    i=0;
    while(memcmp(head, test, N*sizeof(int))){
       memcpy(test, test+1, (N-1)*sizeof(int));
       test[N-1]=rand();
       ++i;
    }
    printf("period=%u\n", i);
    printf("int_max=%d\n", INT_MAX);
    return 0;
}

 

x

arrow
arrow
    全站熱搜

    edisonx 發表在 痞客邦 留言(0) 人氣()