carraysstructc51

Defining struct containing array in C51 not allowed?


Structs containing arrays in C51 are not allowed? After defining a simple structure in my C51 program,

struct RingBuffer 
{
    int zero;
    int size;
    int capacity;
    char data[10]; 
}; 

I got error:..\SOURCE\MYRINGBUFFER.H(25): error C141: syntax error near '['. It is clear that error is on the line with a char array defined in the struct(no errors after commenting).

Am I doing something wrong here? If not, is there anyway I can achieve what I'm attempting to do?

EDIT: All the code.

#ifndef __MY_RING_BUFFER_H__
#define __MY_RING_BUFFER_H__
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct RingBuffer 
{
    int zero;
    int size;
    int capacity;
    char data[10]; 
};


#endif

Solution

  • I figured out what's wrong. data is a keyword in C51.