Piszę program w AVRStudio + WinAVR i mam problem. Kiedy deklarujemy funkcję i w jej argumentach wejściowych znajduje się wskaźnik np. do tabeli jest OK, ale jeżeli jest to wskaźnik do struktury kompilator wywala błędy.
Przykład:
Podczas kompilacji błąd wygląda tak:
Pomocy. Muszę przekazać funkcji wskaźnik do struktury i nie wiem jak
Przykład:
#include <io.h>
#include <iom32.h>
struct bufor {
unsigned char ramka[10];
unsigned short rozmiar;
};
unsigned char Bufor2[100];
struct bufor Bufor1;
void funkcja1(struct bufor* Bufor1)
{
Bufor1.rozmiar=0;
}
void funkcja2(unsigned char* Bufor2)
{
Bufor2[10] = 10;
}
int main(void)
{
Bufor1.ramka[2]=100;
funkcja1(Bufor1);
funkcja2(Bufor2);
while (1) {}
}
Podczas kompilacji błąd wygląda tak:
../structtest.c: In function 'funkcja1':
../structtest.c:16: error: request for member 'rozmiar' in something not a structure or union
../structtest.c: In function 'main':
../structtest.c:29: error: incompatible type for argument 1 of 'funkcja1'
Pomocy. Muszę przekazać funkcji wskaźnik do struktury i nie wiem jak
