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.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…