'CS50 error: called object type 'int' is not a function or function point in C
I'm a newbie at programming and currently I'm taking the CS50 course at Harvard edX. I'm trying to solve the "credit" problem but no matter what I keep myself stuck in this error: called object type 'int' is not a function or point.
I've already tried to read book fragments, answers on this website and nothing makes sense cause, to me (a newbie, I admit), my int is declared a function!! Can someone help me to see the light on this problem? I'll copy and paste my code here below:
int lenght_card = 0;
long visa_start = card;
long amex_start = card;
long master_start = card;
while (card > 0)
{
card = card/10;
lenght_card++;
}
// Identifying the card as Visa
{
visa_start = card/10000000000000;
}
if ((visa_start == 4)(lenght_card == 16 || lenght_card == 13));
{
printf("%s\n," "VISA");
return 0;
PS: the error shows up in the line 86 specifically: (lenght_card == 16 || lenght_card == 13));
Thanks in advance!
Solution 1:[1]
There are typos.
For example in this if statement
if ((visa_start == 4)(lenght_card == 16 || lenght_card == 13));
you need to remove the semicolon at the end of the statement and seems you missed the logical AND operator
if ((visa_start == 4) && (lenght_card == 16 || lenght_card == 13))
Another typo is in this call
printf("%s\n," "VISA");
The comma shall be outside the format string
printf("%s\n", "VISA");
You could just write
puts( "VISA" );
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |