To Write a C program to remove the repeated characters in
the entered expression or in entered characters(i.e)
removing duplicates.
Answer Posted / lijun li
#include <stdio.h>
main(int argc, char **argv)
{
int i;
char *source = argv[1];
char *dest;
char *temp;
unsigned int bitmap[8] = {0,0,0,0,0,0,0,0};
unsigned char c;
unsigned int mask;
dest = (char*)malloc(strlen(source));
temp = dest;
printf("before %s\n", source);
i=0;
while(source[i])
{
c = source[i];
mask = 1 << (c % 32);
if ((bitmap[c/32] & mask) == 0)
{
*temp++ = source[i];
bitmap[c/32] |= mask;
}
i++;
}
*temp = '\0';
printf("after %s\n", dest);
}
| Is This Answer Correct ? | 15 Yes | 22 No |
Post New Answer View All Answers
Hi, i have a project that the teacher want a pyramid of numbers in C# or java...when we click a button...the pyramid should be generated in a listbox/or JtextArea...and the pyramid should have the folowing form: 1 232 34543 4567654 567898765 67890109876 7890123210987 890123454321098 90123456765432109 0123456789876543210 Plz help with codes...didn't find anything on the net.
What is full form of PEPSI
write a simple calculator c program to perform addition, subtraction, mul and div.
how to programme using switch statements and fuctions, a programme that will output two even numbers, two odd numbers and two prime numbers of the users chioce.
Cluster head selection in Wireless Sensor Network using C programming language.
How to palindrom string in c language?
write a function to give demostrate the functionality of 3d in 1d. function prototye: change(int value,int indexX,int indexY,int indexZ, int [] 1dArray); value=what is the date; indexX=x-asix indexY=y-axis indexZ=z-axis and 1dArray=in which and where the value is stored??
Write a Program in 'C' To Insert a Unique Number Only. (Hint: Just Like a Primary Key Numbers In Database.) Please Some One Suggest Me a Better Solution for This question ??
Can you send Code for Run Length Encoding Of BMP Image in C Language in linux(i.e Compression and Decompression) ?
How can you relate the function with the structure? Explain with an appropriate example.
can you use proc sql to manpulate a data set or would u prefer to use proc report ? if so why ? make up an example and explain in detail
Set up procedure for generating a wire frame display of a polyhedron with the hidden edges of the object drawn with dashed lines
write a c program to input initial & final time in the format hh:mm and find the time intervel between them? Ex inputs are initial 06:30 final 00:05 and 23:22 final 22.30
why do you use macros? Explain a situation where you had to incorporate macros in your proc report? use a simple instream data example with code ?
Write a routine to implement the polymarker function