By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,584 Members | 1,065 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,584 IT Pros & Developers. It's quick & easy.

What's wrong with it? Here's my code

P: 1
Expand|Select|Wrap|Line Numbers
  1. #include<stdio.h>
  2. #define PI 3.14;
  3. int main(void)
  4. {
  5.     float r,h,C1,Sa,Sb,Va,Vb;
  6.     scanf("%.2f%.2f",&r,&h);
  7.     C1=(float)2*PI*r;
  8.     Sa=(float)PI*r*r;
  9.     Sb=(float)4*PI*r*r;
  10.     Va=(float)(4/3)*PI*r*r*r;
  11.     Vb=(float)PI*r*r*h;
  12.     printf("C1=%.2f\n
  13.             Sa=%.2f\n
  14.             Sb=%.2f\n
  15.             Va=%.2f\n
  16.             Vb=%.2f",
  17.             C1,Sa,Sb,Va,Vb);
  18. }
errer:invalid type argument of unary'*' (have float)
I'm so confused about it...
Dec 31 '19 #1
Share this Question
Share on Google+
1 Reply


Expert 100+
P: 203
Expand|Select|Wrap|Line Numbers
  1. #define PI 3.14;
PI is replaced by the value 3.14; and not by 3.14
Dec 31 '19 #2

Post your reply

Sign in to post your reply or Sign up for a free account.