[Solved] Program C Simple Little Program Mistake


After the preprocessor runs, you’re left with:

int main()
{

    int girlsAge = ("14" / 2) + 7;
    printf("%s can date girls who are %d or older.\n", "Hunter Shutt", girlsAge);

    return 0;
}

As you can see, "14" is a string, not a number.

#define AGE 14 would fix it, but you’re better using variables rather than typeless defines, since you’ll get much more helpful errors and warnings:

static const char* MYNAME = "Hunter Shutt";
static const int AGE = 14;

1

solved Program C Simple Little Program Mistake