LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-25-2011, 10:44 AM   #1
wang
Member
 
Registered: Dec 2010
Distribution: ubuntu 10.04
Posts: 43

Rep: Reputation: 0
a simple programme with grammar mistake,but i can't find out


i just can't know how to get it work.thanks for any help.
Code:
#include<stdio.h>

main()
{
 int _res;int i=3;int b=5;
_asm_ ("add %1,%0"
      :"=d"(_res):"a" (b),"0" (i));

printf("%d",_res);
}
 
Old 04-25-2011, 10:58 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 19,253

Rep: Reputation: 4435Reputation: 4435Reputation: 4435Reputation: 4435Reputation: 4435Reputation: 4435Reputation: 4435Reputation: 4435Reputation: 4435Reputation: 4435Reputation: 4435
Quote:
Originally Posted by wang View Post
i just can't know how to get it work.thanks for any help.
Code:
#include<stdio.h>

main()
{
 int _res;int i=3;int b=5;
_asm_ ("add %1,%0"
      :"=d"(_res):"a" (b),"0" (i));

printf("%d",_res);
}
And we "can't know" how either, unless you actually tell us WHAT error(s) you're seeing.
 
Old 04-25-2011, 11:02 AM   #3
andywebsdale
Member
 
Registered: Jan 2005
Location: Lewisham,London,UK
Distribution: Debian Wheezy AMD64
Posts: 87
Blog Entries: 2

Rep: Reputation: 23
First, I'm sorry, although I know C/C++, the assembler stuff I'm not 100% on. You may well get an answer here, but for programming questions I'd recommend somewhere like StackOverflow or an appropriate Usenet group(look in Google groups) as well
 
Old 04-25-2011, 03:16 PM   #4
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 721Reputation: 721Reputation: 721Reputation: 721Reputation: 721Reputation: 721Reputation: 721
Quote:
Originally Posted by andywebsdale View Post
First, I'm sorry, although I know C/C++, the assembler stuff I'm not 100% on. You may well get an answer here, but for programming questions I'd recommend somewhere like StackOverflow or an appropriate Usenet group(look in Google groups) as well
There are plenty of programming questions answered here, too.
 
Old 04-26-2011, 01:11 AM   #5
wang
Member
 
Registered: Dec 2010
Distribution: ubuntu 10.04
Posts: 43

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by TB0ne View Post
And we "can't know" how either, unless you actually tell us WHAT error(s) you're seeing.
well,here is the error message.
Code:
nuli@nuli-laptop:~$ gcc ./test.c
./test.c: In function ‘main’:
./test.c:8: error: expected ‘)’ before ‘:’ token
nuli@nuli-laptop:~$
thanks for your reply.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
simple mistake I'm sure lindberg.bill Debian 6 03-26-2007 01:05 AM
simple php class basics mistake spoody_goon Programming 5 07-10-2006 11:46 PM
Help Cant Find A Simple File pengy666 Linux - Software 3 05-06-2005 07:21 PM
where can I find grammar file and lex file of GNU c ? thinks Huiming Linux - Software 1 06-11-2004 08:38 AM
what mistake am i doing for this simple sharing mobassir Linux - Networking 9 10-29-2003 10:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:33 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration