02b2t
ア #include <stdbool.h>
イ #include <stdlib.h>
エ #include "oddsum.h"
カ struct oddsum { int flag, val; };
ク oddsump oddsum_new(void) {
ソ oddsump r = (oddsump)malloc(sizeof(struct oddsum));
ナ r->flag = true;
ニ r->val = 0;
ハ return r;
ス }
コ void oddsum_put(oddsump r, int x) {
チ if(r->flag) {
ヌ r->val = r->val + x;
ス }
テ r->flag = !(r->flag);
ス }
シ int oddsum_get(oddsump r) {
ノ return r->val;
ス }
----------
ア #include <stdbool.h>
イ #include <stdlib.h>
エ #include "oddsum.h"
カ struct oddsum { int flag, val; };
ク oddsump oddsum_new(void) {
ソ oddsump r = (oddsump)malloc(sizeof(struct oddsum));
ニ r->val = 0;
ナ r->flag = true;
ハ return r;
ス }
コ void oddsum_put(oddsump r, int x) {
チ if(r->flag) {
ヌ r->val = r->val + x;
ス }
テ r->flag = !(r->flag);
ス }
シ int oddsum_get(oddsump r) {
ノ return r->val;
ス }
----------
ア #include <stdbool.h>
イ #include <stdlib.h>
エ #include "oddsum.h"
カ struct oddsum { int flag, val; };
ク oddsump oddsum_new(void) {
ソ oddsump r = (oddsump)malloc(sizeof(struct oddsum));
ト r->flag = false;
ニ r->val = 0;
ハ return r;
ス }
コ void oddsum_put(oddsump r, int x) {
テ r->flag = !(r->flag);
チ if(r->flag) {
ヌ r->val = r->val + x;
ス }
ス }
シ int oddsum_get(oddsump r) {
ノ return r->val;
ス }
----------
ア #include <stdbool.h>
イ #include <stdlib.h>
エ #include "oddsum.h"
カ struct oddsum { int flag, val; };
ク oddsump oddsum_new(void) {
ソ oddsump r = (oddsump)malloc(sizeof(struct oddsum));
ニ r->val = 0;
ト r->flag = false;
ハ return r;
ス }
コ void oddsum_put(oddsump r, int x) {
テ r->flag = !(r->flag);
チ if(r->flag) {
ヌ r->val = r->val + x;
ス }
ス }
シ int oddsum_get(oddsump r) {
ノ return r->val;
ス }