Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

3. Program to print all possible substrings.

ex: String
S
St
Str
Stri
Strin
String
t
tr
tri
trin
tring
r

Answer Posted / siraj

#include<stdio.h>

int main()
{

char a[10]="String";
substringTest(a);
getch();
return 0;
}
void substringTest(char *a)
{
int i,j,n,k;
for(n=0; a[n]!='\0'; n++) {}
// n=strlng(a);
for(i=0; i<n; i++)
{

for(j=i; j<n; j++)
{
for(k=i; k<j+1; k++)
{
printf("%c",a[k]);
}
printf("\n");
}

}


}

Is This Answer Correct ?    1 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain what is the advantage of a random access file?

1066


Which operators cannot be overloaded a) Sizeof b) .* c) :: d) all of the above

1092


What is the difference between array and pointer in c?

1087


What are pointers? Why are they used?

1112


largest Of three Number using without if condition?

1525


Function calling procedures? and their differences? Why should one go for Call by Reference?

1040


Is it possible to use curly brackets ({}) to enclose single line code in c program?

1256


What is #include conio h?

942


How can I recover the file name given an open stream or file descriptor?

1029


How can my program discover the complete pathname to the executable from which it was invoked?

1033


number of times a digit is present in a number

1988


Define Spanning-Tree Protocol (STP)

1070


What do you mean by command line argument?

1097


How can I get random integers in a certain range?

1014


What do you mean by keywords in c?

1080