Sunday 12 December 2010

Flow chart for Program that displays the position or index in the string S where the string T begins , or -1 if S doesn’t contain T




Output:


1.enter the first string: kali
Enter the string to be seareched: li
  second string is found in the first string at 2 position
2.enter the first string:
nagaraju
    Enter the string to be seareched:
    raju
    second string is found in the first string at 4 position 3.enter the first string:
   nagarjuna
   Enter the string to be seareched: ma
-1

Conclusion: The program is error free


VIVA QUESTIONS:

1)  What is the difference between printf() and puts() ?
Ans: puts() is used to display the string at a time and it doesn’t take any integers values but printf() takes any values as defined by the user

2)  define pointer variable ?
Ans: pointer variables are defined as variable that contain the memory addresses of data or executable code.

3)  What is use of the strcmp() function ?
Ans: This function compares two strings character by character and returns a value 0 if both strings are equal and non zero value if the strings are different.


Algorithm

c programs

No comments:

Post a Comment