Add documentatin for calc()
This commit is contained in:
parent
7bcacfecac
commit
92b51776b6
1 changed files with 11 additions and 1 deletions
10
netcalc.c
10
netcalc.c
|
@ -72,6 +72,12 @@ int prepsocket(struct addrinfo *ainfo) {
|
|||
return SOCKFD;
|
||||
}
|
||||
|
||||
/// Does the calculation
|
||||
/// @param num1 first operand
|
||||
/// @param num2 second operand
|
||||
/// @param op operator
|
||||
/// @param result stores the result of the calculation
|
||||
/// @return 0 on success, -1 on failure
|
||||
int calc(unsigned int num1, unsigned int num2, char op, unsigned int *result) {
|
||||
switch (op) {
|
||||
case '+':
|
||||
|
@ -101,6 +107,10 @@ int calc(unsigned int num1, unsigned int num2, char op, unsigned int *result) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
/// Converts a string into an integer using its base
|
||||
/// @param numstr input string
|
||||
/// @param num stores the decoded integer
|
||||
/// @return 0 on failure, the encoded base of the integer on success
|
||||
int base(char *numstr, unsigned int *num) {
|
||||
short base = 10;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue