Problem z funkcja [błąd - niezdefiniowana struktura]

0
#include<stdio.h>
#define MAX_A 5
#define MAX_B 50

int fun(struct test (*t)[MAX_A])
{
	int i, j, liczba_znakow = 0, liczba_skrocen = 0;
	
	for (i = 0; i < MAX_A; i++)
	{
		for (j = 0; j < MAX_B; j++)
		{
			if ((*t)[i].napis[j] != '\0')
			{
				liczba_znakow++;
			}
			else
			{
				break;
			}
		}
		
		if ((*t)[i].liczba < liczba_znakow)
		{
			liczba_skrocen += liczba_znakow - (*t)[i].liczba;
			(*t)[i].napis[(*t)[i].liczba] = '\0';
		}
	}
	return liczba_skrocen;
};

struct test
{
	char napis[MAX_B];
	int liczba;
};

int main()
{
	struct test tab[MAX_A];

       fun(&tab)
}

kompilator pokazuje takie błędy , CO robie tu zle ?

Error	C2037	left of 'napis' specifies undefined struct/union 'test'		
Error	C2037	left of 'liczba' specifies undefined struct/union 'test'	
Error	C2037	left of 'liczba' specifies undefined struct/union 'test'		
Error	C2037	left of 'liczba' specifies undefined struct/union 'test'	
Error	C2037	left of 'napis' specifies undefined struct/union 'test'	
1

Przenieś strukturę przed definicję funkcji i po wywołaniu funkcji w main dopisz ;.

0

wydaje mi się, że nie potrzebuje kolega pointera do tablicy a po prostu pointer do pierwszej zmiennej w tablicy.. Ale nie jestem pewien bo to wygląda starsznie i jest nie zformatowane ;-)

1 użytkowników online, w tym zalogowanych: 0, gości: 1