[Updated] Goldman Sachs Aptitude Test Questions and Answers
Practice List of TCS Digital Coding Questions !!!
Take 50+ FREE!! Online Data Interpretation Mock test to crack any Exams.
Interview Questions and Answers :: Hewlett Packard Enterprise

1. Write a program to find sub string in given string.

Answer:

typedef enum {FALSE=0,TRUE} bool;
bool subStringInString(char const * oString, char const *sString)

{
int oLen = 0, sLen = 0;
int i=0,j=0;
oLen = strlen(oString);
sLen = strlen(sString);
for (i = 0;i <=(oLen-sLen); i++)
{
for (j = 0; j < sLen;j++)
{
if (sString[j] != oString[i+j])
break;
}
if (j == sLen)
return TRUE;
}
return FALSE;
}

Post Your Answer Here:      Public      Private

Rate This: +0 -0
Report     

Post Your Reply Here:     

Report Error

Report Error

Please Login First Click Here