Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void summator(void *state, const void *element) {
- *(int *)state += *(const int *)element;
- }
- int main() {
- int result = 0;
- int init_val = 0;
- int a[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
- std_accumulate((void *)(&result), a, sizeof(int), 10, &init_val, summator);
- printf("%d\n", result);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement