warning: passing argument 1 of 'pVacia' from incompatible pointer type [enabled by default]|
note: expected 'struct TPila *' but argument is of type 'struct TPila **'|
warning: passing argument 1 of 'pSacar' from incompatible pointer type [enabled by default]|
note: expected 'struct TPila *' but argument is of type 'struct TPila **'|
warning: passing argument 2 of 'pSacar' from incompatible pointer type [enabled by default]|
note: expected 'char *' but argument is of type 'char **'|
warning: passing argument 1 of 'pVacia' from incompatible pointer type [enabled by default]|
note: expected 'struct TPila *' but argument is of type 'struct TPila **'|
warning: passing argument 1 of 'sacarPila' from incompatible pointer type [enabled by default]|
note: expected 'char *' but argument is of type 'char **'|
warning: passing argument 3 of 'sacarPila' from incompatible pointer type [enabled by default]|
note: expected 'struct TPila *' but argument is of type 'struct TPila **'|
warning: passing argument 1 of 'pPoner' from incompatible pointer type [enabled by default]|
note: expected 'struct TPila *' but argument is of type 'struct TPila **'|
warning: passing argument 2 of 'pPoner' makes integer from pointer without a cast [enabled by default]|
Acá dejo el code y el header:
Código
#include <stdio.h> #include <stdlib.h> #include "Pila.h" #define MAX 50 void sacarPila(char *c, int n, TPila *p) { int i = 0; while(!pVacia(&p) && i <= n) { pSacar(&p, &c); i += 1; } if(pVacia(&p)) { } } void esDigito(char *c, TPila *p) { int i = 10; switch(*c) { case '0': i = 0; case '1': i = 1; case '2': i = 2; case '3': i = 3; case '4': i = 4; case '5': i = 5; case '6': i = 6; case '7': i = 7; case '8': i = 8; case '9': i = 9; } if( i != 10) { sacarPila(&c, i, &p); } else { pPoner(&p, c); } } void vaciarPila(TPila *p) { int i = 0; for(i=0; i<MAX; i++) { (*p).elem[i] = 0; } } int main() { char c; TPila p; FILE *arch; vaciarPila(&p); if ( arch == NULL ) { return 0; } { esDigito(&c, &p); } while(!pLlena(&p)) { pSacar(&p, &c); } return 0; }
Código
#include <stdlib.h> #include <stdbool.h> #define MAX 50 typedef struct Pila { int elem[MAX]; int cima; }TPila; bool pVacia(TPila *p) { return (*p).cima == 0; } bool pLlena(TPila *p) { return (*p).cima == MAX; } void pCrear(TPila *p) { (*p).cima = 0; } void pPoner(TPila *p, char x) { (*p).cima = (*p).cima + 1; (*p).elem[(*p).cima] = x; } void pSacar(TPila *p, char *c) { *c = (*p).elem[(*p).cima]; (*p).cima = (*p).cima + 1; }