Skip to content
Snippets Groups Projects
Verified Commit cec71102 authored by raphael.bach's avatar raphael.bach
Browse files

Add sequential `array_sum.c`

parent 0ddda6ea
Branches
No related tags found
No related merge requests found
#include <stdint.h> // uint8_t
#include <stdlib.h> // EXIT_SUCCESS, size_t
#include <string.h> // memcpy()
#define T uint64_t
#define X_LEN 10
#define Y_LEN 10
int main(void)
{
T in[] = {
1,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,1,
2,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,2,
3,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,3,
4,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,4
};
#define size (sizeof(in)/sizeof(T))
T out = 0;
for(size_t i = 0; i < size; i++) {
out += in[i];
}
return EXIT_SUCCESS;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment