Why does code give bash: syntax error on Linux but runs on Windows?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • saronyo bose
    New Member
    • Dec 2010
    • 3

    #1

    Why does code give bash: syntax error on Linux but runs on Windows?

    the given code does not run in linux mint isodara.
    on typing
    cc pg206[G](c).c

    in terminal it gives

    bash: syntax error near unexpected token `('

    wat to do ........
    the above code runs in windows turbo c 3.0

    the code is as follows
    Code:
    #include<stdio.h>
    
    void fun(int *,int *);
    
    void main()
    
    {
    
    	int i=5,j=2;
    
    	fun(&i,&j);
    
    	printf("\n%d %d",i,j);
    
    }
    
    void fun(int *i,int *j)
    
    {
    
    	*i=*i**i;
    
    	*j=*j**j;
    
    		
    
    }
    Last edited by Niheel; Dec 5 '10, 08:44 PM.
  • donbock
    Recognized Expert Top Contributor
    • Mar 2008
    • 2427

    #2
    You say this code does not run; but the bash error you report is more indicative of a failure during the build process. Is the name of your source file truly pg206[G](c).c ? If so, could you rename the file to get rid of the square brackets and parentheses? I suspect the bash shell believes those characters are commands for it.

    Comment

    Working...