So basically I have the following task: "Write a program that reads all input and prints, for each paragraph, the number of words and lines. A paragraph is a portion of text that does not start with a newline, ends with a single newline or EOF and is separated by at least one newline from other paragraphs.". And so far I wrote this:
Code:

Code:
#include <stdio.h>
#include <ctype.h>
int countParagraphs(){
    int noParagraphs=0;
    int c1=getchar();
    int c2=getchar();
    if(c1!='\n'){
        c1=c2;
    }
    if(c1='\n' && c2 != EOF) // if the first character is newline and we haven't reached the end of the entire text, the number of paragraphs rises 
        noParagraphs++;
    }
    return noParagraphs;
    
}
int countWords(){
    int noWords=0;
    int c1=getchar();
    if(c1 != '\n'){
        if(isalpha(c1)){
        noWords++;
        }
        while(c1!=EOF){
            int c2=getchar();
            if(isspace(c1) && isalpha(c2)){ // if the first char is a space and a second is a letter => the number of words rises
                noWords++;
            }
            c1=c2;
        }
        return noWords;
    }
    int countLines(){
        int noLines=0;
        int c1=getchar();
        while(isalnum(c1) || isspace(c1)){  //while the first char is a letter, digit or space continue reading the sequence
            int c2=getchar();
            c1=c2;
        }
        if((issalnum(c1) || issspace(c1) && c2='\n'){ // if we have a letter, digit or space before newline, increase the number of lines
           noLines++;
        }
           
        return noLines;
        


int main(){
    




}


Now, to explain my thought process: I thought I would split the program into 3 functions, one to count the number of paragraphs, another to count the words on a paragraph (which I'm having trouble with) and a third counting the number of lines. I'm a newbie in C (stating the obvious), and I'm still learning the basics. I know I probably made a bunch of mistakes writing the program so far, but I'm stuck and I don't know how to continue. Also, I need help with designing the main function in order to be able to write a text, so that I can see the output based on that text. Thank you!!