Dashboard Temp Share Shortlinks Frames API

HTMLify

LeetCode - Convert the Temperature - C
Views: 1 | Author: abh
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#include <stdlib.h>
// @leet start
/**
 * Note: The returned array must be malloced, assume caller calls free().
 */
double* convertTemperature(double celsius, int* returnSize) {
    double *ans = malloc(sizeof(double)*2);
    ans[0] = celsius + 273.15;
    ans[1] = celsius * 1.80 + 32.00;
    *returnSize = 2;
    return ans;
}
// @leet end