Like Tree1Likes
  • 1 Post By Salem

Multiple Functions Within A Program

This is a discussion on Multiple Functions Within A Program within the C Programming forums, part of the General Programming Boards category; Hi I am getting an error on lines 31 and 36 about an expected identifier on my program that computes ...

  1. #1
    Registered User
    Join Date
    Jan 2013
    Posts
    28

    Multiple Functions Within A Program

    Hi I am getting an error on lines 31 and 36 about an expected identifier on my program that computes area and circumference. Is something wrong with my external functions outside of main? Thank you.


    Code:
    #include <stdio.h>
    #define PI 3.14159
    
    double area;
    double circum;
    
    double find_circum (double radius);
    double find_area (double radius);
    
    
    int
    main(void)
    {
          double radius;
    
          /* Get the circle radius */
          printf("Enter radius> ");
          scanf("%lf", &radius);
    
          area = find_area(radius);
          circum = find_circum(radius);
    
          printf("The area is %.4g\n", area);
          printf("The circumference is %.4g\n", circum);
    
    }
    
          double find_area (double radius);
          {
          return PI * radius * radius;
          }
    
          double find_circum (double radius);
         {
          return 2.0 * PI * radius;
         }

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,855
    Code:
          double find_area (double radius);
          {
          return PI * radius * radius;
          }
     
          double find_circum (double radius);
         {
          return 2.0 * PI * radius;
         }
    Delete these ;
    M_A_T_T likes this.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    Jan 2013
    Posts
    28
    Quote Originally Posted by Salem View Post
    Code:
          double find_area (double radius);
          {
          return PI * radius * radius;
          }
     
          double find_circum (double radius);
         {
          return 2.0 * PI * radius;
         }
    Delete these ;
    Thank you sir!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Functions with multiple definitions
    By Jdo300 in forum C Programming
    Replies: 4
    Last Post: 03-13-2010, 06:55 PM
  2. Multiple functions
    By rculley1970 in forum C Programming
    Replies: 13
    Last Post: 11-25-2006, 04:42 PM
  3. multiple functions
    By buckwheat88 in forum C Programming
    Replies: 4
    Last Post: 11-02-2005, 03:13 PM
  4. Calling multiple functions
    By martina in forum C Programming
    Replies: 8
    Last Post: 04-09-2003, 10:14 PM
  5. Recursion vs multiple functions
    By PJYelton in forum C++ Programming
    Replies: 4
    Last Post: 12-29-2002, 08:52 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21