Thread: error stray 240 in program

  1. #1
    Registered User
    Join Date
    Nov 2016
    Posts
    3

    error stray 240 in program

    I'm looking for a bit of help here with my program. I keep getting a error saying stray 240 in program on a lot of the lines in my code. can anyone show me were I went wrong and how do I fix it? any help would be great I'm stuck at this for the last 4 hours and cant solve it

    Code:
    #include <math.h>
    void input(int *, int *);
    void calculation(int, int, int*, int*);
    void output(int, int, int, int);
    int main()
    {  
     int feet, inches , meters, centimeters;
     input(&feet, &inches);
     calculation(feet, inches, &meters, &centimeters);
     output(feet, inches, meters, centimeters);
    void input(int *f, int *i)
    {
      printf("Enter feet:\n");
      scanf("%d", f);
      printf("Enter inches:\n");
      scanf("%d", i);
    }
    void calculation(int f, int i, int *m, int *c);
    {
      *m=f*0.312;
      *c=i*2.54;
    }
    void output(int f, int i, int m, int c)
    {
      printf("%d feet and %d inches converted is %d meters and %d  centimeters \n", f, i, m, c);
    }
        do
            {
               printf("To go again      press Y\n"); // send back to start 
               printf("To exit program  press N\n"); // exits program            
               scanf("%c", &choice);
            } 
        while(choice != 'Y' && choice != 'y' && choice != 'N' && choice != 'n');
        while(choice == 'Y' || choice == 'y');
    }  
    return 0;

  2. #2
    Registered User
    Join Date
    Nov 2016
    Posts
    3
    found out what was wrong, when I moved all my code tight to the left it worked

  3. #3
    Registered User
    Join Date
    Jun 2015
    Posts
    1,640
    I have no idea what "stray 240" is, but your code is a total mess. You can't define functions inside of main. Put them after main. Then space your program properly and make sure all the braces and loops match up.

  4. #4
    Registered User
    Join Date
    Jun 2015
    Posts
    1,640
    Quote Originally Posted by sean146 View Post
    found out what was wrong, when I moved all my code tight to the left it worked
    "Stray 240" probably means byte values of decimal 240 (0xF0) that somehow ended up in your program text. Moving your code to the left probably erased them. You should reformat it now.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. error stray 342 in programm
    By Nantia Atzo in forum C Programming
    Replies: 8
    Last Post: 04-14-2016, 03:06 AM
  2. Replies: 4
    Last Post: 04-11-2016, 03:58 AM
  3. Stray Error while compiling
    By Mankthetank19 in forum C Programming
    Replies: 6
    Last Post: 02-03-2011, 03:24 PM
  4. What does: 'error: stray ‘o357’ in program' mean?
    By Phanixis in forum Linux Programming
    Replies: 8
    Last Post: 12-04-2010, 01:48 AM
  5. C compiling / error: stray ‘\’ in program
    By Elya in forum C Programming
    Replies: 5
    Last Post: 07-02-2009, 08:20 AM

Tags for this Thread