1/* 2 * Copyright 2020, Data61, CSIRO (ABN 41 687 119 230) 3 * 4 * SPDX-License-Identifier: BSD-2-Clause 5 */ 6 7#include <camkes.h> 8#include <stdio.h> 9#include <payload.h> 10 11int run(void) 12{ 13 int operands[] = { 342, 74, 283, 37, 534 }; 14 int sz = sizeof(operands) / sizeof(int); 15 const char *name = get_instance_name(); 16 17 printf("%s: what's the answer to ", name); 18 for (int i = 0; i < sz; i++) { 19 printf("%d ", operands[i]); 20 if (i != sz - 1) { 21 printf("+ "); 22 } 23 } 24 printf("?\n"); 25 26 payload_t p = {0}; 27 p.sz = sz; 28 for (int i = 0; i < sz; i++) { 29 p.operands[i] = operands[i]; 30 } 31 32 a_calculate(&p); 33 34 printf("%s: result was %d\n", name, p.result); 35 return 0; 36} 37