Sunday, July 12, 2009

Write a program in c for strcmpi without using library function?

iam serching job somany comapnies asking this question but iam not getting lz reply anybody

Write a program in c for strcmpi without using library function?
/*library function means--yoy cant use "strcmp" function*/


#include%26lt;stdio.h%26gt;


#include%26lt;conio.h%26gt;


#include%26lt;stdlib.h%26gt;





void main()


{char *str1[],*str2[];


pf("Entr 1st string");gets(str1);


pf("Entr 2nd strng");


gets("str2);


r=stcomp(str1,str2);


pf("%d--ths is function returning 0 for same",r;


getch();


}





int stcomp(*a,*b)


{int z=0;


while(*a!=NULL %26amp;%26amp; *b!=NULL)


{if(*a!=*b)


z=*a-*b;


return z;


a++;b++;


}


}





*/hope,ths will help you[:)]*/


No comments:

Post a Comment