write a c prog for removing duplicate character from an
array and sorting remaining elements using a single array
Answer / 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 |
#include<stdio.h> #include<conio.h> void main() { int m=0111,n=20; printf("%d%d\n",m,n); getch(); }
What is %d used for?
Can a function be forced to be inline? Also, give a comparison between inline function and the C macro?
6)swap(int x,y) { int temp; temp=x; x=y; y=temp; } main() { int x=2;y=3; swap(x,y); } after calling swap ,what are yhe values x&y?
What is #line in c?
Explain #pragma in C.
What is define directive?
how to build a exercise findig min number of e heap with list imlemented?
#‎include‬<stdio.h> void main() { int i; for(i=5;0;i++) { printf("%d",i); } }
What should be keep precautions while using the recursion method?
Main must be written as a.the first function in the program b.Second function in the program c.Last function in the program d.any where in the program
19 Answers CTS, HCL, TCS,
What does *p++ do? What does it point to?