Click here to Skip to main content
15,881,938 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I am getting this error: inline assembler syntax error in 'opcode'; found '('

I don't know where I have gone wrong.

What I have tried:

The code is:

for (i = 0; items[i] != 0; i++)
{
for (j = 0; j <= items[i]; j++)
printChar('*');
}

(note: items is a pointer to an address)
Posted
Updated 19-Oct-17 5:19am
v2
Comments
Richard MacCutchan 19-Oct-17 11:23am    
Why open a new question, rather than asking at the solution that I gave in your previous one. And, as a number of people have mentioned, stop using assembler, it does nothing useful.

Lose the second for loop with the variable j. There is no need for that.

Also, there is no need for this to be inline assembler. That is all C code.
 
Share this answer
 
Comments
Richard MacCutchan 19-Oct-17 11:24am    
The second loop is necessary. I provided this code as a suggestion in OP's previous question.
[no name] 19-Oct-17 11:31am    
Thank you!
Take the lines which switch you into and output assembler out of your C code:
__asm

Looking at your previous question: How do I print a certain number of stars in C programming?[^]
I'd say you don't need any assembler - you only ever need it for very specific things you can't do in C - and a simple exercise like this should never need assembler code!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900