1.

Differentiate between the string functions strcmp() and strcmpi(). 

Answer»

strcmp(): 

It is used to compare two strings and returns an integer. 

Syntax: strcmp(string1,string2) 

  • if it is 0 both strings are equal.
  •  if it is greater than 0(i.e. +ve) stringl is greater than string2 
  • if it is less than 0(i.e. -ve) string2 is greater than string1 

strcmpi(): It is same as strcmp() but it is not case sensitive. That means uppercase and lowercase are treated as same. 

eg: “ANDREA” and “Andrea” and “andrea” these are same.



Discussion

No Comment Found

Related InterviewSolutions