Skip to content

Instantly share code, notes, and snippets.

@prozacchiwawa
Last active April 30, 2022 10:15
Show Gist options
  • Save prozacchiwawa/cd9621f741608b7ecdb6dff85bca9ba4 to your computer and use it in GitHub Desktop.
Save prozacchiwawa/cd9621f741608b7ecdb6dff85bca9ba4 to your computer and use it in GitHub Desktop.
/* no warnings in desmet c 2.4
C> C88 FORBIDDE.C
C> BIND FORBIDDE.O
*/
#include <stdio.h>
struct X {
int typ;
int x_str;
int next;
};
struct Y {
int typ;
int v;
};
f(x)
register x;
{
register t = 0;
while (x) {
if (x->typ == 'X') {
t += strlen(x->x_str);
x = x->next;
} else {
t++;
x = 0;
}
}
return t;
}
int main() {
register p, q;
p = malloc(sizeof(struct X));
p->typ = 'X';
p->x_str = "hi there";
q = malloc(sizeof(struct Y));
q->typ = 'Y';
q->v = 'e';
p->next = q;
printf("p %x q %x f(p) %d\n", p, q, f(p));
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment