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
What is c token?
What are enumerated types?
Write a program to maintain student’s record. Record should
not be available to any unauthorized user. There are three
(3) categories of users. Each user has its own type. It
depends upon user’s type that which kind of operations user
can perform. Their types and options are mentioned below:
1. Admin
(Search Record [by Reg. No or Name], View All Records,
Insert New Record, Modify Existing Record)
2. Super Admin
(Search Record [by Reg. No or Name], View All Records,
Insert New Record, Modify Existing Record, Delete Single Record)
3. Guest
(Search Record [by Reg. No or Name], View All Records)
When first time program runs, it asks to create accounts.
Each user type has only 1 account (which means that there
can be maximum 3 accounts). In account creation, following
options are required:
Login Name: <6-10 alphabets long, should be unique>
Password: <6-10 alphabets long, should not display
characters when user type>
Confirm Password:
How can I prevent another program from modifying part of a file that I am modifying?
What is structure in c explain with example?
Tell us two differences between new () and malloc ()?
What is pointer and structure in c?
Write a Program to find whether the given number or string is palindrome.
What math functions are available for integers? For floating point?
Explain what is a const pointer?
What is a const pointer in c?
explain what is an endless loop?
Explain how can you tell whether a program was compiled using c versus c++?
how to capitalise first letter of each word in a given string?
Explain goto?