From: Vic Newsgroups: comp.os.msdos.djgpp Subject: Re: "Problem with a text string" Date: Fri, 22 May 1998 16:55:00 -0400 Organization: Communications Accessibles Montreal, Quebec Canada Lines: 28 Message-ID: <3565E624.1E64@cam.org> References: <6k4lhm$6ne$1 AT talia DOT mad DOT ibernet DOT es> NNTP-Posting-Host: dialup-392.hip.cam.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk JOA wrote: > > Hello, the program: > #include > char name[]; > main() > { > printf ("Write your name:"); > scanf ("%s",&name); > if (nombre=="John") printf ("hello John"); > else printf ("Error"); > } > > Always write "Error" if i write "John", but never write "hello John". What > can i do? Learn proper C? this should work better: #include char name[30]; main() { printf ("Write your name:"); scanf ("%s",&name); if (!strcmp(name,"John")) printf ("hello John"); else printf ("Error"); }