+ Post New Thread
Results 1 to 5 of 5
  1. #1
    Full Member level 5
    Points: 2,302, Level: 11

    Join Date
    Nov 2011
    Location
    india
    Posts
    263
    Helped
    2 / 2
    Points
    2,302
    Level
    11

    What's the problem in my C program?

    Hello
    I wrote program to find largest of three numbers. I am using gcc compiler. When I was compiling first time it was showing some result but again when I tried to complies same program it showing error. Now I don't why it's happening. what's wrong in program or compiler ?

    Program

    Code C - [expand]
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    
    #include <stdio.h>
    int main(void)
    {
        int a, b, c, max;
        max = a;
       
        printf(" enter three numbers \n ");
        scanf("%d %d %d",&a,&b,&c);
        
        if(max < b)
     {
            max = b;
     }
        else if(max < c)
     {
            max = c;
     }
      
        printf("\n largest %d ",max);
         
     return 0;
    }

    Error
    hello.c:16:6: error: stray '\240' in program
    A A A A A A A A max = c;
    ^
    hello.c:16:7: error: stray '\302' in program
    A A A A A A A A max = c;
    ^
    hello.c:16:8: error: stray '\240' in program
    A A A A A A A A max = c;
    ^
    hello.c:16:9: error: stray '\302' in program
    A A A A A A A A max = c;
    Last edited by bassa; 6th December 2017 at 18:18. Reason: add code tag

    •   Alt6th December 2017, 17:54

      advertising

        
       

  2. #2
    Advanced Member level 4
    Points: 5,034, Level: 16

    Join Date
    Apr 2016
    Posts
    1,061
    Helped
    189 / 189
    Points
    5,034
    Level
    16

    Re: What's the problem in my C program?

    you have special characters that are probably not visible in your text editor but are caught by your compiler. just google 'stray \240' and the very first hit explains it well.
    Really, I am not Sam.



    •   Alt6th December 2017, 18:29

      advertising

        
       

  3. #3
    Full Member level 5
    Points: 2,302, Level: 11

    Join Date
    Nov 2011
    Location
    india
    Posts
    263
    Helped
    2 / 2
    Points
    2,302
    Level
    11

    Re: What's the problem in my C program?

    Quote Originally Posted by ThisIsNotSam View Post
    you have special characters that are probably not visible in your text editor but are caught by your compiler. just google 'stray \240' and the very first hit explains it well.
    I copy paste code, that I have already made because it take a lot of time to write new code every time. I used to do this But then there was no problem. It's been happening for a few days. how to fix this issue



    •   Alt6th December 2017, 21:36

      advertising

        
       

  4. #4
    Advanced Member level 4
    Points: 5,034, Level: 16

    Join Date
    Apr 2016
    Posts
    1,061
    Helped
    189 / 189
    Points
    5,034
    Level
    16

    Re: What's the problem in my C program?

    whatever you are copying from, it already has the issue in it. very very simple.. I mean, if you can't debug this incredibly naive mistake, how are you going to write software?
    Really, I am not Sam.



  5. #5
    Advanced Member level 5
    Points: 11,664, Level: 25
    Achievements:
    7 years registered

    Join Date
    Apr 2010
    Posts
    1,786
    Helped
    386 / 386
    Points
    11,664
    Level
    25

    Re: What's the problem in my C program?

    this situation may happen when the source is in utf and target is ascii edior.



--[[ ]]--