forked from algorithm-archivists/algorithm-archive
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixing C warnings (algorithm-archivists#934)
* Added warnings as errors for C/C++ code and fixed C warnings.
- Loading branch information
Showing
10 changed files
with
54 additions
and
54 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,40 @@ | ||
#include <stdio.h> | ||
#include <math.h> | ||
#include <stdlib.h> | ||
|
||
int euclid_mod(int a, int b) { | ||
a = abs(a); | ||
b = abs(b); | ||
a = abs(a); | ||
b = abs(b); | ||
|
||
while (b != 0) { | ||
int temp = b; | ||
b = a % b; | ||
a = temp; | ||
} | ||
while (b != 0) { | ||
int temp = b; | ||
b = a % b; | ||
a = temp; | ||
} | ||
|
||
return a; | ||
return a; | ||
} | ||
|
||
int euclid_sub(int a, int b) { | ||
a = abs(a); | ||
b = abs(b); | ||
|
||
while (a != b) { | ||
if (a > b) { | ||
a -= b; | ||
} else { | ||
b -= a; | ||
} | ||
a = abs(a); | ||
b = abs(b); | ||
|
||
while (a != b) { | ||
if (a > b) { | ||
a -= b; | ||
} else { | ||
b -= a; | ||
} | ||
} | ||
|
||
return a; | ||
return a; | ||
} | ||
|
||
int main() { | ||
int check1 = euclid_mod(64 * 67, 64 * 81); | ||
int check2 = euclid_sub(128 * 12, 128 * 77); | ||
int check1 = euclid_mod(64 * 67, 64 * 81); | ||
int check2 = euclid_sub(128 * 12, 128 * 77); | ||
|
||
printf("%d\n", check1); | ||
printf("%d\n", check2); | ||
printf("%d\n", check1); | ||
printf("%d\n", check2); | ||
|
||
return 0; | ||
return 0; | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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