I'm learning at GCC and while I was trying various solutions to verify the entry of a certain word, IF Word = Word {do something;}
It seems that in C it cannot be done directly and so I tried this solution that seems to work:
#include <stdio.h>#include <string.h>int main(){ int CClose = 0; int VerifyS = 0; char PWord[30] ={'\0'}; do { printf("\n Type a word: "); scanf(" %s", &PWord); VerifyS = strncmp(PWord, "exit", 4); if (!VerifyS){ CClose = 1;}else{ printf("\n The Word is:%s", PWord);} }while (CClose != 1); return 0; }
I wanted to know if there is another way to do the same thing.Thank you.