Very good formula deriving. It's actually also shown in wikipedia Pascal Triangle entry.

Here is the C version:

int *getRow(int rowIndex, int *returnSize) {
// For row n, the k th element, the entry is the product of its previous entry and (n + 1 - k)/k.
*returnSize = rowIndex + 1;
int *row = malloc(*returnSize * sizeof(int));
int k = 0;
row[k] = 1;
while (++k < *returnSize) {
row[k] = (unsigned long long)row[k - 1] * (*returnSize - k) / k;
}
return row;
}