24 game/C: Difference between revisions
m
Fixed syntax highlighting.
(→24 game: CRT components) |
m (Fixed syntax highlighting.) |
||
Line 2:
===rpn.h===
<
#define RC_RPN_H 1
#include <string.h>
Line 23:
bool rpn_evaluate(const char *);
#endif</
===rpn.c===
{{uses from|Library|C Runtime|component1=va_list|component2=va_start|component3=fprintf|component4=vfprintf|component5=va_end|component6=NULL|component7=malloc|component8=strtok|component9=strtod|component10=strcpy|component11=strlen|component12=assert|component13=free}}
<
static double stack[RPN_STACK_LIMIT];
Line 161:
free(buf);
return true; // should check if it's all ok...
}</
===24 game===
Now we have something able to evaluate simple expression; so here it is the game.
{{uses from|Library|C Runtime|component1=rand|component2=RAND_MAX|component3=malloc|component4=strlen|component5=strcpy|component6=strtok|component7=printf|component8=free|component9=ranged_rand|component10=fgets|component11=fabs}}
<
#include <stdlib.h>
#include <string.h>
Line 275:
return 0;
}</
|