Skip to main content
Commonmark migration
Source Link

#C

C

A few (implementation dependent) ideas:

##1 main() { char a[] = "uKyKrvKrwKstKusK"; unsigned int i;

1

main()
{
    char a[] = "uKyKrvKrwKstKusK";
    unsigned int i;

    for(i = 0; i >= 0; i++)
    {
        printf("%c", (char)(a[i&(sizeof(a)-2)] - 'A'));
    }
}

##2

2

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

#define Answer_to_the_Ultimate_Question_of_Life_The_Universe_and_Everything  I_may_be_a_sorry_case_but_I_dont_write_jokes_in_base_13(Six by nine)
#define Six 0b110
#define by *
#define nine 0b1001
#define I_may_be_a_sorry_case_but_I_dont_write_jokes_in_base_13(x) 10*(x/13)+x%13

void PrintNumSequence(void);

int main(void)
{
    PrintNumSequence();
}

/*
Prints out the following sequence forever: http://lostpedia.wikia.com/wiki/The_Numbers
*/
void PrintNumSequence(void)
{
    int a[] = {sizeof(int), sizeof(double), DBL_DIG, strlen(__func__), __LINE__, Answer_to_the_Ultimate_Question_of_Life_The_Universe_and_Everything};
    unsigned int i;

    while(1)
    {
        for(i = 0; i < sizeof(a)/sizeof(a[0]); i++)
        {
            printf("%d \n", a[i]);
        }
    }
}

#C

A few (implementation dependent) ideas:

##1 main() { char a[] = "uKyKrvKrwKstKusK"; unsigned int i;

    for(i = 0; i >= 0; i++)
    {
        printf("%c", (char)(a[i&(sizeof(a)-2)] - 'A'));
    }
}

##2

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

#define Answer_to_the_Ultimate_Question_of_Life_The_Universe_and_Everything  I_may_be_a_sorry_case_but_I_dont_write_jokes_in_base_13(Six by nine)
#define Six 0b110
#define by *
#define nine 0b1001
#define I_may_be_a_sorry_case_but_I_dont_write_jokes_in_base_13(x) 10*(x/13)+x%13

void PrintNumSequence(void);

int main(void)
{
    PrintNumSequence();
}

/*
Prints out the following sequence forever: http://lostpedia.wikia.com/wiki/The_Numbers
*/
void PrintNumSequence(void)
{
    int a[] = {sizeof(int), sizeof(double), DBL_DIG, strlen(__func__), __LINE__, Answer_to_the_Ultimate_Question_of_Life_The_Universe_and_Everything};
    unsigned int i;

    while(1)
    {
        for(i = 0; i < sizeof(a)/sizeof(a[0]); i++)
        {
            printf("%d \n", a[i]);
        }
    }
}

C

A few (implementation dependent) ideas:

1

main()
{
    char a[] = "uKyKrvKrwKstKusK";
    unsigned int i;

    for(i = 0; i >= 0; i++)
    {
        printf("%c", (char)(a[i&(sizeof(a)-2)] - 'A'));
    }
}

2

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

#define Answer_to_the_Ultimate_Question_of_Life_The_Universe_and_Everything  I_may_be_a_sorry_case_but_I_dont_write_jokes_in_base_13(Six by nine)
#define Six 0b110
#define by *
#define nine 0b1001
#define I_may_be_a_sorry_case_but_I_dont_write_jokes_in_base_13(x) 10*(x/13)+x%13

void PrintNumSequence(void);

int main(void)
{
    PrintNumSequence();
}

/*
Prints out the following sequence forever: http://lostpedia.wikia.com/wiki/The_Numbers
*/
void PrintNumSequence(void)
{
    int a[] = {sizeof(int), sizeof(double), DBL_DIG, strlen(__func__), __LINE__, Answer_to_the_Ultimate_Question_of_Life_The_Universe_and_Everything};
    unsigned int i;

    while(1)
    {
        for(i = 0; i < sizeof(a)/sizeof(a[0]); i++)
        {
            printf("%d \n", a[i]);
        }
    }
}
Fixed (technical) violation of the rules in a comment
Source Link
jerry
  • 499
  • 3
  • 10

#C

A few (implementation dependent) ideas:

##1 main() { char a[] = "uKyKrvKrwKstKusK"; unsigned int i;

    for(i = 0; i >= 0; i++)
    {
        printf("%c", (char)(a[i&(sizeof(a)-2)] - 'A'));
    }
}

##2

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

#define Answer_to_the_Ultimate_Question_of_Life_The_Universe_and_Everything  I_may_be_a_sorry_case_but_I_dont_write_jokes_in_base_13(Six by nine)
#define Six 0b110
#define by *
#define nine 0b1001
#define I_may_be_a_sorry_case_but_I_dont_write_jokes_in_base_13(x) 10*(x/13)+x%13

void PrintNumSequence(void);

int main(void)
{
    PrintNumSequence();
}

/*
Prints out the following sequence forever: 4 8 15 16 23 42http://lostpedia.wikia.com/wiki/The_Numbers
*/
void PrintNumSequence(void)
{
    int a[] = {sizeof(int), sizeof(double), DBL_DIG, strlen(__func__), __LINE__, Answer_to_the_Ultimate_Question_of_Life_The_Universe_and_Everything};
    unsigned int i;

    while(1)
    {
        for(i = 0; i < sizeof(a)/sizeof(a[0]); i++)
        {
            printf("%d \n", a[i]);
        }
    }
}

#C

A few (implementation dependent) ideas:

##1 main() { char a[] = "uKyKrvKrwKstKusK"; unsigned int i;

    for(i = 0; i >= 0; i++)
    {
        printf("%c", (char)(a[i&(sizeof(a)-2)] - 'A'));
    }
}

##2

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

#define Answer_to_the_Ultimate_Question_of_Life_The_Universe_and_Everything  I_may_be_a_sorry_case_but_I_dont_write_jokes_in_base_13(Six by nine)
#define Six 0b110
#define by *
#define nine 0b1001
#define I_may_be_a_sorry_case_but_I_dont_write_jokes_in_base_13(x) 10*(x/13)+x%13

void PrintNumSequence(void);

int main(void)
{
    PrintNumSequence();
}

/*
Prints out the following sequence forever: 4 8 15 16 23 42
*/
void PrintNumSequence(void)
{
    int a[] = {sizeof(int), sizeof(double), DBL_DIG, strlen(__func__), __LINE__, Answer_to_the_Ultimate_Question_of_Life_The_Universe_and_Everything};
    unsigned int i;

    while(1)
    {
        for(i = 0; i < sizeof(a)/sizeof(a[0]); i++)
        {
            printf("%d \n", a[i]);
        }
    }
}

#C

A few (implementation dependent) ideas:

##1 main() { char a[] = "uKyKrvKrwKstKusK"; unsigned int i;

    for(i = 0; i >= 0; i++)
    {
        printf("%c", (char)(a[i&(sizeof(a)-2)] - 'A'));
    }
}

##2

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

#define Answer_to_the_Ultimate_Question_of_Life_The_Universe_and_Everything  I_may_be_a_sorry_case_but_I_dont_write_jokes_in_base_13(Six by nine)
#define Six 0b110
#define by *
#define nine 0b1001
#define I_may_be_a_sorry_case_but_I_dont_write_jokes_in_base_13(x) 10*(x/13)+x%13

void PrintNumSequence(void);

int main(void)
{
    PrintNumSequence();
}

/*
Prints out the following sequence forever: http://lostpedia.wikia.com/wiki/The_Numbers
*/
void PrintNumSequence(void)
{
    int a[] = {sizeof(int), sizeof(double), DBL_DIG, strlen(__func__), __LINE__, Answer_to_the_Ultimate_Question_of_Life_The_Universe_and_Everything};
    unsigned int i;

    while(1)
    {
        for(i = 0; i < sizeof(a)/sizeof(a[0]); i++)
        {
            printf("%d \n", a[i]);
        }
    }
}
Source Link
jerry
  • 499
  • 3
  • 10

#C

A few (implementation dependent) ideas:

##1 main() { char a[] = "uKyKrvKrwKstKusK"; unsigned int i;

    for(i = 0; i >= 0; i++)
    {
        printf("%c", (char)(a[i&(sizeof(a)-2)] - 'A'));
    }
}

##2

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

#define Answer_to_the_Ultimate_Question_of_Life_The_Universe_and_Everything  I_may_be_a_sorry_case_but_I_dont_write_jokes_in_base_13(Six by nine)
#define Six 0b110
#define by *
#define nine 0b1001
#define I_may_be_a_sorry_case_but_I_dont_write_jokes_in_base_13(x) 10*(x/13)+x%13

void PrintNumSequence(void);

int main(void)
{
    PrintNumSequence();
}

/*
Prints out the following sequence forever: 4 8 15 16 23 42
*/
void PrintNumSequence(void)
{
    int a[] = {sizeof(int), sizeof(double), DBL_DIG, strlen(__func__), __LINE__, Answer_to_the_Ultimate_Question_of_Life_The_Universe_and_Everything};
    unsigned int i;

    while(1)
    {
        for(i = 0; i < sizeof(a)/sizeof(a[0]); i++)
        {
            printf("%d \n", a[i]);
        }
    }
}