Arrays do not have the assignment operator. They are non-modifiable lvalues.
From the C Standard (6.3.2.1 Lvalues, arrays, and function designators)
- ...A modifiable lvalue is an lvalue that does not have array type,
does not have an incomplete type, does not have a const qualified
type, and if it is a structure or union, does not have any member
(including, recursively, any member or element of all contained
aggregates or unions) with a const qualified type.
So instead of this assignment statement
c = (temp>=80 ? strcpy(c,"swimming"):
(60<=temp<80 ? strcpy(c,"tennis"):
(40<=temp<60 ? strcpy(c,"Golf"):
strcpy(c,"skiing 1."))));
where you are using wrong logical expressions like 60<=temp<80
(that always evaluates to logical true because the subexpression 60 <= temp
evaluates either to integer 0
or 1
that in any case is less than 80
) you should write
(temp>=80 ? strcpy(c,"swimming"):
(60<=temp && temp <80 ? strcpy(c,"tennis"):
(40<=temp && temp <60 ? strcpy(c,"Golf"):
strcpy(c,"skiing 1."))));
Though for readability it would be much better to rewrite this statement with using if-else statements like
if ( temp>=80 )
{
strcpy(c,"swimming");
}
else if ( temp >= 60 )
{
strcpy(c,"tennis");
}
else if ( temp >= 40 )
{
strcpy(c,"Golf");
}
else
{
strcpy(c,"skiing 1.");
}