3. Program to print all possible substrings.
ex: String
S
St
Str
Stri
Strin
String
t
tr
tri
trin
tring
r
Answer Posted / rafiq
#include<stdio.h>
#include<conio.h>
#include<string.h>
main()
{
int i,j,n,k;
char a[10]="String";
i=0;
n=strlen(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");
}
}
getch();
}
| Is This Answer Correct ? | 51 Yes | 23 No |
Post New Answer View All Answers
What are the different types of control structures?
Can one function call another?
Are the expressions * ptr ++ and ++ * ptr same?
What are the string functions? List some string functions available in c.
What is #include stdlib h?
Why c is a procedural language?
Can static variables be declared in a header file?
What should malloc(0) do?
What is the role of this pointer?
Where define directive used?
Linked list is a Linear or non linear explain if linear how it working as a non linear data structures
When can you use a pointer with a function?
can we have joblib in a proc ?
Define Spanning-Tree Protocol (STP)
What is the difference between #include and #include 'file' ?