Skip to content

Instantly share code, notes, and snippets.

@giorgi568
giorgi568 / itob.c
Created August 9, 2024 14:32
the c programming language book, exercise 3-5
#include <stdio.h>
/*
itob(n,s,b) converts the integer n into a base
b character representation in the string s.
b could be up to 36. after that we run out of letters.
*/
void itob(int n, char h[], int b);
void reverse(char s[], int len);
@giorgi568
giorgi568 / itoa.c
Created August 9, 2024 14:50
the c programming language book, exercise 5-6
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <limits.h>
/*
code is from the book, i only added minimal witdth -- w
*/
void itoa(int n, char s[], int w);
@giorgi568
giorgi568 / strindex.c
Created August 10, 2024 17:30
the c programming language, exercise 4-1
#include <stdio.h>
#include <string.h>
/*
code is from the book i only modified strindex,
which now returns rightmost occurrence of t in s
*/
#define MAXLINE 1000
@giorgi568
giorgi568 / atof.c
Created August 10, 2024 22:51
the c programming language book, exercise 4-2
#include <stdio.h>
#include <math.h>
#include <ctype.h>
/*
code is from the book, i changed atof function to
make it handle scientific notations like :
"123.45e-6"
*/