Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
  • 2 commits
  • 1 file changed
  • 0 commit comments
  • 1 contributor
Commits on Jan 18, 2012
@chrisabruce chrisabruce Included <stdlib.h> in Numbers so that abs doesn't create a warning. …
…There are lots of function in different "libraries", you will get used to including the correct ones.
8238a21
@chrisabruce chrisabruce Added some comments and fixed 11/3.0 example. c47da1c
Showing with 2 additions and 1 deletion.
  1. +2 −1 Numbers/Numbers/main.c
View
3 Numbers/Numbers/main.c
@@ -7,6 +7,7 @@
//
#include <stdio.h>
+#include <stdlib.h> //Need to include this for abs function
int main (int argc, const char * argv[])
{
@@ -16,7 +17,7 @@ int main (int argc, const char * argv[])
printf("y is %.2e\n", y);
printf("3 * 3 + 5 * 2 = %d\n", 3 * 3 + 5 * 2);
printf("11 / 3 = %d remainder of %d \n", 11 / 3, 11 % 3);
- printf("11 / 3.0 = %f\n", (float)3);
+ printf("11 / 3.0 = %f\n", 11 / 3.0); // Adding the .0 to 3.0 makes it a float.
printf("The absolute value of -5 is %d\n", abs(-5));

No commit comments for this range

Something went wrong with that request. Please try again.