Last active
August 29, 2015 14:13
-
-
Save crissilvaeng/5ccbe9469e6296259822 to your computer and use it in GitHub Desktop.
C Coding Style
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
#define SUCCESS 0 | |
#define NULL_ARGS 1 | |
#define NULL_PARAM -1 |
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
#include <stdio.h> | |
#include "error.h" | |
int unsigned_sum( const unsigned int& x, const unsigned int& y ); | |
int main( int argc, char* argv[] ) | |
{ | |
if( argc != 0 ) | |
{ | |
unsigned int a, b; | |
unsigned_sum( a, b ); | |
return SUCCESS; | |
} else { | |
return NULL_ARGS; | |
} | |
} | |
int unsigned_sum( const unsigned int& x, const unsigned int& y ) | |
{ | |
if( !x || !y ) | |
{ | |
return NULL_PARAM; | |
} | |
return x + y; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment