Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C basic Questions Hello, can you answer these questions and explain why? I thoug

ID: 3753187 • Letter: C

Question

C basic Questions

Hello, can you answer these questions and explain why?

I thought the answer was long int long int but i figured out im completely wrong and cant understand when and why it would be float or double.

(a) Given the following declarations, answer the following questions:

int a; float b; double c; long int d;

*What will be the data type for the result of the following statement ?d+b+a;

*What will be the data type for the result of the following statement ? a=b+c;

*What will be the data type for the result of the following statement ? d*a+c;

*What will be the data type for the result of the following statement ? a*b*c*d;

Explanation / Answer

ANSWER 1: here in the first question d+b+a one is float other is int and other is long int so here datatype for this will be long int because in c if we want to add different data type numbers then we have to convert all the variable in the same data type but we change for longest data type to hold all small range data type this is called implicit type casting in C. so here your result will store in long int.

ANSWER 2: here a is int type so result value will be as int.

ANSWER 3: Here answer 1 is also the explanation.

ANSWER 4: here also ANSWER 1 will be the explanation.