write a c prog for removing duplicate character from an
array and sorting remaining elements using a single array
Answer Posted / b sohan lal
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char s[15],a[15];
int i,j,n;
clrscr();
printf("enter the string");
scanf("%s",s);
for(i=0;s[i]!='\0';i++)
{
if(s[i]!=s[i+1])
a[i]=s[i];
}
n=strlen(a);
for(i=0;s[i]!='\0';i++)
{
for(j=0;j<=n-i-1;j++)
{
if(a[j]>=a[j+1])
{
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
}
}
printf("the sorted string is:%s",a);
getch();
}
Is This Answer Correct ? | 2 Yes | 2 No |
Post New Answer View All Answers
Write a function that will take in a phone number and output all possible alphabetical combinations
The number of bytes of storage occupied by short, int and long are a) 2, 2 and 4 b) 2, 4 and 4 c) 4, 4 and 4 d) none
What are variables c?
Explain how do you determine whether to use a stream function or a low-level function?
In C programming, how do you insert quote characters (‘ and “) into the output screen?
What is the scope of global variable in c?
Explain what does a function declared as pascal do differently?
What are the advantages of external class?
Describe wild pointers in c?
What the advantages of using Unions?
Describe how arrays can be passed to a user defined function
What are the different types of pointers used in c language?
What is the difference between the expression “++a” and “a++”?
What are the back slash character constants or escape sequence charactersavailable in c?
What is a program?