Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Cannot declare objects of Structures in Mikroc

Status
Not open for further replies.

Naumanpak

Member level 2
Joined
Nov 19, 2009
Messages
51
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Location
Pakistan
Activity points
1,635
Experts, Its me again..

Using mikroc c compiler and cannot declare structure objects.

struct information
{
int speedlimit;
char name[30];
};

struct decoded
{
float latitude;
char latitude_dir;
float longitude;
char longitude_dir;
int speed;
float angle;
information info;
long time;
};

get an error on the bold line. Same is the case in main(), I get errors on declaring one. Any suggestions??


thanks.
 

Use either typedef or keyword struct as in the following examples.

typedef struct information
{
.........
};

struct decoded
{
..........
information info;
long time;
};

OR

struct information
{
.........
};

struct decoded
{
..........
struct information info;
long time;
};

Hope this works with MicroC.
 
thanks Numa, I finally got it working!

It was the difference of syntax between the two compilers.


cheers
 
Actually, this is standard C :)
A good reference is C Programming by Example.
--
Amr
 

    Naumanpak

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top