Home » Ask & Discuss » Board Exams - CBSE, ICSE, State Boards » Computer Science « Back to Discussion



Computer Science

varsha valli g.'s Avatar
Blazing goIITian

Joined: 31 Jan 2007
Post: 515
25 Mar 2008 11:13:30 IST
0 People liked this
2
698 View Post
simple but crucial !!!!!
None

in a strcmp statement if the 2 strings are equal is it the condition of true or false i.e 1 or 0,i always get confused with this,wanna get cleared atleast now.
if(strcmp(str1,str2)>0)---------> wat does dis >0 imply?
 
plz reply soon
rates assured!!!!!


Share this article on:

Comments (2)

gokul subramanian's Avatar

Blazing goIITian

Joined: 28 Jan 2008
Posts: 1451
25 Mar 2008 11:36:17 IST
2 people liked this

c in both strings u r traversing from left to rite
let elements of str1 be ai and tht of str2 be bi
now for each i it goes on checkin which is greater...for the 1st such i found it returns>0 if ai>bi and <0 for ai<bi

eg computer(str1) n commander(str2)
now a0=b0,a1=b1,a2=b2 buta3>b3
hence returns >0 for strcmp(str1,str2)

but if u had given strcmp(str2,str1)
the same eg as above will return <0 as the second string(str1) is greater in terms of the idea ive expressed above
10904him's Avatar

Hot goIITian

Joined: 29 Dec 2006
Posts: 191
25 Mar 2008 11:40:48 IST
1 people liked this

It means that the first string is greater than the second
i.e it lies earlier in the dictionary



Quick Reply


Reply

Some HTML allowed.
Keep your comments above the belt or risk having them deleted.
Signup for a avatar to have your pictures show up by your comment
If Members see a thread that violates the Posting Rules, bring it to the attention of the Moderator Team
Free Sign Up!

Preparing for IIT-JEE ?

Arihant Revision Package for IIT JEE - Books, Practice Tests + Rank Predictor


@ INR 1,995/-

For Quick Info

Name

Mobile No.

Find Posts by Topics

Physics.

Topics

Mathematics.

Chemistry.

Biology

Parents

Board

Fun Zone

Sponsored Ads