Notre professeur nous a demandé de vérifier si un mot est un palindrome en utilisant des piles. Chaque fois que je l'exécute, il y a une erreur: Unhandled Exception. Access violation
Qu'est-ce que je fais mal? Comment puis-je améliorer mon code? Mon code est le suivant:Palindrome Utilisation d'une pile
typedef struct stack{
char name;
struct stack * next;
}Stack;
void push(Stack**head, char value);
char pop(Stack**head);
int main(){
char word[11];
int i=0;
int lenght = 0;
Stack*head = NULL;
printf("Please type the word: ");
scanf("%s", word);
lenght = strlen(word);
while(word[i]!='\0'){
push(&head, word[i]);
i++;
}
i = 0;
while(pop(&head)==word[i]){
i++;
}
if(i==lenght) printf("The word is a palindrome");
else printf("The word is not a palindrome");
}
premier: utiliser '' value' au lieu de la valeur [i] 'dans la signature des fonctions. – ruslik