So you want to generate all possible subsets of a set of numbers and list their sum.
First, you want to enumerate all the subsets. Since there are 2 ^ N subsets in a set containing N elements, you can simply do this by iterating through the natural numbers from 0 to 1 << (sizeof(arr) / sizeof(arr[0])) and treating the binary representation of the number in the following manner: if a particular bit is set at position k, then the kth element is in the currently generated subset, else it isn't.
Then, you should add all the selected elements together and store the result in the next slot of another array (sized 2 ^ N, obviously).
#define COUNT(a) (sizeof(a) / sizeof(a[0]))
#include <limits.h> // for CHAR_BIT
unsigned a[3] = { 1, 3, 8 };
unsigned sums[1 << COUNT(a)] = { 0 };
for (unsigned i = 0; i < COUNT(sums); i++) {
for (unsigned j = 0; j < sizeof(i) * CHAR_BIT; j++) {
if ((i >> j) & 1) {
sums[i] += a[j];
}
}
}
for (unsigned i = 0; i < COUNT(sums); i++) {
printf("%d\n", sums[i]);
}