This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Stray \302 error


On Wed, Aug 31, 2011 at 6:53 AM, Avinash Sonawane
<avinash.sonawane1990@gmail.com> wrote:
> Respected Sir,
> I am using gcc version 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4)
> I wrote one simple program but after compiling it, its showing me some
> unusual errors .
> Please help.
>
> Program:
>
> # include <stdio.h>
> # include <stdlib.h>
>
> ?int main()
> ?{
> ?int *p;
> ?int n,i;
>
> ?printf("No. Of Elements = ");
> ?scanf("%d",&n);
>
> ?p = (int *) malloc(n*sizeof(int));
>
> ?for(i=0;i<n;i++)
> ?scanf("%d",(p+i));
>
> ? for(i=0;i<n;i++)
> ?printf("%d\t",*(p+i));
>
> ?printf("\n");
>
> ?free(p);
>
> ?return 0;
> ?}
>
> Terminal:
>
> avinash@titanic:/Remastersys/Documents/Programs/c$ gcc dm.c -o dm
> dm.c: In function ‘main’:
> dm.c:17:1: error: stray ‘\302’ in program
> dm.c:17:1: error: stray ‘\240’ in program
You have copy/pasted code from the web. I ran across the same issue
when copy/paste from code.google.com in the past.

You will see the miscreant characters in a hex editor. You will *not*
see them using gedit. And gedit does not properly search/replace - you
will need to use emacs, vi, etc.

Jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]