c - Error expected ')' before 'R' -


estoy usando lenguaje c . composicion de funciones

esta es mi primer funcion ( function 1 )

int volumencilindro (int y, int h) {     int volumencilindro = ( pow (y,2)* 3.14 * h );         return volumencilindro;  } 

y esta es la segunda funcion ( , second function )

int volumencilindrohueco (int r, int r, int h) {  int volumencilindrohueco =  (volumencilindro r  h) - (volumencilindro  r  h);   return volumencilindrohueco ; }    int main () { int r; int r; int h;  int volumencilindrohueco = (r,r,h);   printf (" calcular el volumen del cilindro hueco...");  printf ( " ingrese el radio del cilindro mayor... %d",r );  printf  ( " ingrese el radio del cilindro menor ...%d",r );  printf ( " ingrese la altura  de ambos cilindros ... %d",h);    volumencilindrohueco = (r,r,h);  printf ( " el resultado es ... %d",volumencilindrohueco );  system("pause");  return 0;  } 

and error

error expected ')' before 'r'  

gracias por su ayuda , soy nuevo en este lenguaje y no podido empezar en el tema de composicion de funciones. gracias

  1. this

    (volumencilindro r  h) - (volumencilindro  r  h) 

    should replaced by

    volumencilindro (r,  h) - volumencilindro  (r,  h) 
  2. this

    int volumencilindrohueco = (r,r,h); 

    should replaced by

    int volumencilindrohueco1; 
  3. and this

    volumencilindrohueco = (r,r,h); 

    should replaced by

    volumencilindrohueco1 = volumencilindrohueco(r,r,h); 

    you need change volumencilindrohueco volumencilindrohueco1 in following printf().

  4. in main(), r, r, h uninitialized, may need scanf(" %d", &r); initialize them. therefore, this

    printf ( " ingrese el radio del cilindro mayor... %d",r ); 

    should replaced by

    printf ( " ingrese el radio del cilindro mayor... "); scanf (" %d", &r); 

Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -