-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions1.c
More file actions
29 lines (22 loc) · 776 Bytes
/
functions1.c
File metadata and controls
29 lines (22 loc) · 776 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "main.h"
/************************* PRINT UNSIGNED NUMBER *************************/
int print_unsigned(va_list types, char buffer[], int flags, int width, int precision, int size)
{
unsigned long int num = va_arg(types, unsigned long int);
num = convert_size_unsgnd(num, size);
int i = BUFF_SIZE - 2;
if (num == 0)
buffer[i--] = '0';
buffer[BUFF_SIZE - 1] = '\0';
while (num > 0)
{
buffer[i--] = (num % 10) + '0';
num /= 10;
}
i++;
return write_unsgnd(0, i, buffer, flags, width, precision, size);
}
/************* PRINT UNSIGNED NUMBER IN OCTAL ****************/
int print_octal(va_list types, char buffer[], int flags, int width, int precision, int size)
{
unsigned long int num = va_arg