add comments bc i will forget what's going on

This commit is contained in:
NaiJi ✨ 2024-05-02 17:52:00 +04:00
parent de32013d6c
commit 536dc5aca7
17 changed files with 36 additions and 0 deletions

View File

@ -3,6 +3,8 @@
#define PRINT 0 #define PRINT 0
#define SKIP 1 #define SKIP 1
// printing control chars
main() main()
{ {
int c; int c;

View File

@ -3,6 +3,10 @@
#define IN 1 #define IN 1
#define OUT 0 #define OUT 0
// counting words from getstream,
// doesn't work with backspace
// (by design)
main() main()
{ {
int c, nl, nw, nc, state; int c, nl, nw, nc, state;

View File

@ -3,6 +3,8 @@
#define IN 1 #define IN 1
#define OUT 0 #define OUT 0
// converting input string to one word per line
main() main()
{ {
int c, state, word_ending; int c, state, word_ending;

View File

@ -2,6 +2,8 @@
#define MAX_AMOUNT_OF_LENGTHS 256 #define MAX_AMOUNT_OF_LENGTHS 256
// drawing chart of words lengths
main() main()
{ {
int c, i, j; int c, i, j;

View File

@ -2,6 +2,8 @@
#define MAX_AMOUNT_OF_LENGTHS 256 #define MAX_AMOUNT_OF_LENGTHS 256
// drawing chart of chars usage
main() main()
{ {
int c, i, j; int c, i, j;

View File

@ -1,5 +1,7 @@
#include <stdio.h> #include <stdio.h>
// creating a function to convert celsius to fahrenheit
double to_fahr(double celsius) double to_fahr(double celsius)
{ {
return (celsius * 9.0 / 5.0) + 32.0; return (celsius * 9.0 / 5.0) + 32.0;

View File

@ -2,6 +2,9 @@
#define MAXLINE 10 #define MAXLINE 10
// forcing getline to output actual amount of characters
// from input even if it exceedes MAXLINE boundary
int _getline(char line[], int maxline); int _getline(char line[], int maxline);
void copy(char to[], char from[]); void copy(char to[], char from[]);

View File

@ -5,6 +5,8 @@
#define MAXTEXT 3000 #define MAXTEXT 3000
#define SELECTION_LENGTH 10 #define SELECTION_LENGTH 10
// output all strings that are longer than MAXLINE
int _getline(char line[], int maxline); int _getline(char line[], int maxline);
int copy(char to[], int head, char from[]); int copy(char to[], int head, char from[]);

View File

@ -5,6 +5,8 @@
int _getline(char line[], int maxline); int _getline(char line[], int maxline);
void trim(char to[], char from[], int from_head); void trim(char to[], char from[], int from_head);
// remove all extra spaces and tabs from tail of input
main() main()
{ {
char line[MAXLINE]; char line[MAXLINE];

View File

@ -5,6 +5,8 @@
int _getline(char line[], int maxline); int _getline(char line[], int maxline);
void reverse(char to[], char from[], int from_head); void reverse(char to[], char from[], int from_head);
// reversing input string
main() main()
{ {
int len; int len;

View File

@ -1,5 +1,7 @@
#include <stdio.h> #include <stdio.h>
// replacing tabs with spaces so it keeps indentation
int _getline(char s[], int lim) int _getline(char s[], int lim)
{ {
int c, i, j; int c, i, j;

View File

@ -1,5 +1,7 @@
#include <stdio.h> #include <stdio.h>
// replacing empty strings consisting of only spaces
// to tabs and spaces so it keeps initial indentation
int _getline(char s[], int lim) int _getline(char s[], int lim)
{ {

View File

@ -1,5 +1,7 @@
#include <stdio.h> #include <stdio.h>
// converting Fahrenheit to Celsius
main() main()
{ {
float fahr, celsius; float fahr, celsius;

View File

@ -1,5 +1,6 @@
#include <stdio.h> #include <stdio.h>
// converting celsius to fahrenheit
main() main()
{ {
float fahr, celsius; float fahr, celsius;

View File

@ -1,5 +1,7 @@
#include <stdio.h> #include <stdio.h>
// converting fahrenheit to celsius
main() main()
{ {
for (int fahr = 300; fahr >= 0; fahr = fahr - 20) for (int fahr = 300; fahr >= 0; fahr = fahr - 20)

View File

@ -1,5 +1,7 @@
#include <stdio.h> #include <stdio.h>
// counting spaces, tabs and newlines
main() main()
{ {
int c; int c;

View File

@ -3,6 +3,8 @@
#define NORMAL 0 #define NORMAL 0
#define SPACEBARING 1 #define SPACEBARING 1
// trimming excessive spacebars down to one
main() main()
{ {
int c; int c;