After take string as an input from user , How to apply that inputed string in if-else statement ???
include <stdio.h> int main() { int choice; char name[15]; printf("\n\n>>>DIGITAL PERIODIC TABLE"); printf("\n1.ENTER BY NAME"); printf("\n2.ENTER BY SYMBOL"); printf("\n\nENTER YOUR CHOICE : "); scanf("%d",&choice); printf("\n\nENTER NAME :- "); scanf("%s",name); //I don't want whitespaces so not used gets() function okk.... printf("\n\n you entered :- %s",name); if(name=="hydrogen") printf("\n\n ELEMENT FOUND...."); else if (name=="lithium") printf("\n\nLITHIUM ELEMENT FOUND.."); else printf("\n\nNOT FOUND ANY ELEMENT"); //I am trying this code but its not working after entered the element name as hydrogen... //this program only show "Not found any element" /*Should all the element name declares in the char array before running the program...i tried it also but not found any result...*/ Help pls...