Skip to main content
edited body
Source Link

myMy program readability.c compiles and gets input. It's supposed to return the number of letters in the input text. I'm getting this error instead of the answer. If you can help me you'll be welcome. Thanks. Here's my code:

#include <stdio.h>
#include <cs50.h>
#include <ctype.h>
#include <string.h>

int main(void)
{
    string str = get_string("Text: ");


    char n = 1;

    int count_letters = n+1;

    size_t strlen(const char *str);

    {
        if (isalpha(str))
        ;
        printf("%d letter(s)\n", n);
    }

}

my program readability.c compiles and gets input. It's supposed to return the number of letters in the input text. I'm getting this error instead of the answer. If you can help me you'll be welcome. Thanks. Here's my code:

#include <stdio.h>
#include <cs50.h>
#include <ctype.h>
#include <string.h>

int main(void)
{
    string str = get_string("Text: ");


    char n = 1;

    int count_letters = n+1;

    size_t strlen(const char *str);

    {
        if (isalpha(str))
        ;
        printf("%d letter(s)\n", n);
    }

}

My program readability.c compiles and gets input. It's supposed to return the number of letters in the input text. I'm getting this error instead of the answer. If you can help me you'll be welcome. Thanks. Here's my code:

#include <stdio.h>
#include <cs50.h>
#include <ctype.h>
#include <string.h>

int main(void)
{
    string str = get_string("Text: ");


    char n = 1;

    int count_letters = n+1;

    size_t strlen(const char *str);

    {
        if (isalpha(str))
        ;
        printf("%d letter(s)\n", n);
    }

}
Source Link

Fatal error "segmentation fault" when trying to run program

my program readability.c compiles and gets input. It's supposed to return the number of letters in the input text. I'm getting this error instead of the answer. If you can help me you'll be welcome. Thanks. Here's my code:

#include <stdio.h>
#include <cs50.h>
#include <ctype.h>
#include <string.h>

int main(void)
{
    string str = get_string("Text: ");


    char n = 1;

    int count_letters = n+1;

    size_t strlen(const char *str);

    {
        if (isalpha(str))
        ;
        printf("%d letter(s)\n", n);
    }

}