By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 1,376 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

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

P: 3
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
Expand|Select|Wrap|Line Numbers
  1. #include<stdio.h>
  2.  
  3. void fun(int *,int *);
  4.  
  5. void main()
  6.  
  7. {
  8.  
  9.     int i=5,j=2;
  10.  
  11.     fun(&i,&j);
  12.  
  13.     printf("\n%d %d",i,j);
  14.  
  15. }
  16.  
  17. void fun(int *i,int *j)
  18.  
  19. {
  20.  
  21.     *i=*i**i;
  22.  
  23.     *j=*j**j;
  24.  
  25.  
  26.  
  27. }
Dec 4 '10 #1
Share this Question
Share on Google+
1 Reply


Expert 100+
P: 2,396
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.
Dec 4 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.