Created
March 18, 2019 00:05
-
-
Save dbremner/2226a0cfae5630e574f30331ae4d997c to your computer and use it in GitHub Desktop.
Two test cases for functions in https://lobste.rs/s/e7vp0t/arithmetical_way_check_for_number
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<limits.h> | |
#include<stdlib.h> | |
#include<stdio.h> | |
int f1(int num) | |
{ | |
const int result = abs(num) - num; | |
return result; | |
} | |
int f2(int num) | |
{ | |
const int result = num - abs(num); | |
return result; | |
} | |
int main() | |
{ | |
const int test_value = INT_MIN; | |
const int result1 = f1(test_value); | |
const int result2 = f2(test_value); | |
printf("f1:%d\n", result1); | |
printf("f2:%d\n", result2); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment