Vi allego la mia funzione e i relativi errori che mi escono
Questo è l'header chiamato stack.h
Codice: Seleziona tutto
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct stackNode{
char data;
struct stackNode *nextPr;
};
typedef struct stackNode StackNode;
typedef StackNode *StackNodePtr;
int isOperator(char c);
int precedence(char operator1, char operator2);
void push(StackNodePtr *topPtr, char value);
Questa è la funzione push in c
Codice: Seleziona tutto
#include "stack.h"
void push(StackNodePtr *topPtr, char value)
{
StackNodePtr *newNode;
newNode =(struct stackNode *)malloc(sizeof(struct stackNode));
if( newNode != NULL ){
newNode->data = value;
newNode->nextPr = *topPtr;
*topPtr = newNode;
}else
printf( "***ERROR*** Non puoi allocare memoria per questo oggetto\n" );
}
[Error] request for member 'data' in something not a structure or union
[Error] request for member 'nextPr' in something not a structure or union
[Warning] assignment from incompatible pointer type [enabled by default]
Grazie ragazzi, devo rimettermi in corsa col C