![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
lilayta
Joined: 26 Feb 2004 Posts: 3
|
Compiler error |
Posted: Mon Mar 01, 2004 5:49 am |
|
|
Hello,
Iam making a division between two integers numbers , and Iam using the structure div_t. The problem is , the compiler always give me the same error :" expecting a variable"
The goal of the program is to select the hundred, tens of units of a decimal number, to put onto 3 displays of 7 segments.
The code of the visualization is not represented here.
I don't know if faults me some instruccion or if something in my code is wrong. Here it is my code:
#include <16f877.h>
#include <string.h>
#include <stdlib.h>
...
main()
{
...
div_t x;
x=div(grados,100);
centenas = x.quot;
num1 = x.rem;
x=div(num1,10);
decenas = x.quot;
unidades=x.rem;
... |
|
![](templates/subSilver/images/spacer.gif) |
Al
Joined: 13 Nov 2003 Posts: 28 Location: Belfast
|
|
Posted: Mon Mar 01, 2004 6:33 am |
|
|
Are you sure this is where your problem lies? It compiles fine for me. I don't know what you have declared your variables as, but I declred them as ints.
int grados, centenas, num1, decenas, unidades;
What complier are you using? _________________ Alan Murray |
|
![](templates/subSilver/images/spacer.gif) |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|