24 game/C: Difference between revisions

m
Fixed syntax highlighting.
m (Sections.)
m (Fixed syntax highlighting.)
 
(2 intermediate revisions by one other user not shown)
Line 2:
 
===rpn.h===
<langsyntaxhighlight lang="c">#ifndef RC_RPN_H
#define RC_RPN_H 1
#include <string.h>
Line 23:
bool rpn_evaluate(const char *);
 
#endif</langsyntaxhighlight>
 
===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}}
 
<langsyntaxhighlight lang="c">#include "rpn.h"
 
static double stack[RPN_STACK_LIMIT];
Line 161:
free(buf);
return true; // should check if it's all ok...
}</langsyntaxhighlight>
 
===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}}
 
<langsyntaxhighlight lang="c">#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Line 275:
 
return 0;
}</langsyntaxhighlight>
9,476

edits