Quantcast
[ 3 / biz / cgl / ck / diy / fa / g / ic / jp / lit / sci / tg / vr ] [ index / top / reports / report a bug ] [ 4plebs / archived.moe / rbt ]

Maintenance is complete! We got more disk space.
Become a Patron!

/g/ - Technology

Search:


View post   

[ Toggle deleted replies ]
>> No.54057255 [View]
File: 36 KB, 381x499, beyondfizzbuzz.jpg [View same] [iqdb] [saucenao] [google] [report]
54057255

who here ludum dare?

>> No.53355586 [View]
File: 36 KB, 381x499, fizzbuzz.jpg [View same] [iqdb] [saucenao] [google] [report]
53355586

>> No.52201184 [View]
File: 36 KB, 381x499, fizzbuzz.jpg [View same] [iqdb] [saucenao] [google] [report]
52201184

>>52201131
>this kills the self-taught no-degree pleb

>> No.51848170 [View]
File: 33 KB, 381x499, beyond-fizzbuzz.jpg [View same] [iqdb] [saucenao] [google] [report]
51848170

>tfw started the "average 2 ints" meme
>tfw going strong on its own now
pic related: the original pic posted with the challenge

>> No.51491677 [View]
File: 33 KB, 381x499, beyond-fizzbuzz.jpg [View same] [iqdb] [saucenao] [google] [report]
51491677

Are you ready for round 2, /g/?

>protip: you aren't

>> No.51488714 [View]
File: 33 KB, 381x499, beyond-fizzbuzz.jpg [View same] [iqdb] [saucenao] [google] [report]
51488714

Hey /g/, do you know how to average 2 ints in C?

>protip: you don't!

>> No.51421139 [View]
File: 33 KB, 381x499, beyond-fizzbuzz.jpg [View same] [iqdb] [saucenao] [google] [report]
51421139

Old thread at >>51412882

The "I don't know C but I try really hard" edition

void float_as_u(float f, unsigned *u)
{
if (sizeof f != sizeof *u) {
abort();
}
memcpy(u, &f, sizeof *u);
}

int test(void)
{
float f = 1;
unsigned u, *p = malloc(sizeof *p);
if (!p) {
abort();
}
float_as_u(f, &u);
float_as_u(f, p);
printf("u = %u\n", u);
printf("*p = %u\n", *p);
free(p);
}

>> No.50947549 [View]
File: 33 KB, 381x499, beyond-fizzbuzz.jpg [View same] [iqdb] [saucenao] [google] [report]
50947549

All right /g/, let's see how you do on interview question, the "stepping it up a notch from fizzbuzz" edition: Write a C function "int avg(int a, int b)" that returns the average of 2 integers rounded towards zero. I'd be surprised to see a solution.



Navigation
View posts [+24] [+48] [+96]