ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   SiteMap shows list of All Categories in this site.
Google
 
Categories  >>  Code Snippets  >>  Programming Code  >>  C Code
 
 


 

 
 C Code interview questions  C Code Interview Questions
 C++ Code interview questions  C++ Code Interview Questions
 VC++ Code interview questions  VC++ Code Interview Questions
 Java Code interview questions  Java Code Interview Questions
 Dot Net Code interview questions  Dot Net Code Interview Questions
 Visual Basic Code interview questions  Visual Basic Code Interview Questions
 Programming Code AllOther interview questions  Programming Code AllOther Interview Questions
Question
to remove the repeated cahracter from the given caracter 
array.
i.e..,
if the input is SSAD
output should of 
SAD
 Question Submitted By :: Selva909
I also faced this Question!!     Rank Answer Posted By  
 
  Re: to remove the repeated cahracter from the given caracter array. i.e.., if the input is SSAD output should of SAD
Answer
# 1
use lookup array
 
Is This Answer Correct ?    0 Yes 0 No
Umesh
 
  Re: to remove the repeated cahracter from the given caracter array. i.e.., if the input is SSAD output should of SAD
Answer
# 2
string s,str;
            s = string.Empty;
            str = this.txtString.Text;
            foreach (char c in str)
            {
                if (s.IndexOf(c) == -1)
                {
                    s = s + c.ToString(); 
                }
            }
            this.label1.Text = s;
 
Is This Answer Correct ?    0 Yes 1 No
Mohanraja
[I-Net Solution]
 
 
 
  Re: to remove the repeated cahracter from the given caracter array. i.e.., if the input is SSAD output should of SAD
Answer
# 3
#include<stdio.h>
void main()
{
  char arr[]="aaadddssdsejskld";
  int char_check=0;
  int i,j;
  char c;
  clrscr();
    while(arr[char_check])
    {
	  c=arr[char_check];
	  i=j=char_check+1;
	   while(arr[i])
	   {
		if(arr[i]!=c)
		{
			arr[j]=arr[i];
			j++;
		}
			i++;
	   }        arr[j]='\0';
			char_check++;
	}
   for(i=0;arr[i]!='\0';i++)
	printf (" \n%c\n " ,arr[i]);
	}
 
Is This Answer Correct ?    0 Yes 0 No
Krishna
 
  Re: to remove the repeated cahracter from the given caracter array. i.e.., if the input is SSAD output should of SAD
Answer
# 4
#include<stdio.h>
void main()
{
  char arr[]="aaadddssdsejskld";
  int char_check=0;
  int i,j;
  char c;
  clrscr();
    while(arr[char_check])
    {
	  c=arr[char_check];
	  i=j=char_check+1;
	   while(arr[i])
	   {
		if(arr[i]!=c)
		{
			arr[j]=arr[i];
			j++;
		}
			i++;
	   }        arr[j]='\0';
			char_check++;
	}
   for(i=0;arr[i]!='\0';i++)
	printf (" \n%c\n " ,arr[i]);
	}
 
Is This Answer Correct ?    0 Yes 1 No
Krishna
 
  Re: to remove the repeated cahracter from the given caracter array. i.e.., if the input is SSAD output should of SAD
Answer
# 5
#include<stdio.h>
int main()
{
int i=0,j,x=-1;
char str[10],temp,temp1,buff[10];
printf("\nEnter the string ");
scanf("%s",str);
while((temp=str[i])!=NULL)
 {
 for(j=0;j<=x;j++)
  {
  temp1=buff[j];
  if(temp==temp1)
   {
   break;
   }
  }
  if(j>x)
   buff[++x]=temp;
  i++;
 }
 buff[++x]='\0';
 printf("\n%s",buff);
return 0;
}
 
Is This Answer Correct ?    0 Yes 1 No
Welkin
 
  Re: to remove the repeated cahracter from the given caracter array. i.e.., if the input is SSAD output should of SAD
Answer
# 6
#include<stdio.h>
main()
{
	char arr[]="ssadddvhdfgiweuonbbnxjcusdfssd";
	int i=0,j,k;
	printf("Before string is %s \n",arr);
	while(arr[i]!=0)
	{
		for(j=i+1;arr[j]!=0;j++)
		{
			if(arr[i]==arr[j])
			{
				for(k=j;arr[k]!=0;k++)
					arr[k]=arr[k+1];
				arr[k]='\0';
				j--;
			}
		}
		i++;
	}
	printf("After string is %s \n",arr);
}
 
Is This Answer Correct ?    2 Yes 0 No
Vijay
 

 
 
 
Other C Code Interview Questions
 
  Question Asked @ Answers
 
Find the largest number in a binary tree Infosys4
Give a very good method to count the number of ones in a 32 bit number. (caution: looping through testing each bit is not a solution) Microsoft4
how can u draw a rectangle in C Wipro24
Print an integer using only putchar. Try doing it without using extra storage.  1
How to access command-line arguments?  4
plz send me all data structure related programs  1
Given an array of size N in which every number is between 1 and N, determine if there are any duplicates in it. You are allowed to destroy the array if you like. Microsoft8
How do I write a program to print proper subset of given string . Eg :input: abc output:{},{a},{b},{c},{a,b},{a,c},{b,c}, {a,b,c}.I desperately need this program please mail me to saravana6m@gmail.com Deshaw8
Write a routine to draw a circle (x ** 2 + y ** 2 = r ** 2) without making use of any floating point computations at all. Microsoft2
Finding a number multiplication of 8 with out using arithmetic operator NetApp7
Link list in reverse order. NetApp7
Write a C function to search a number in the given list of numbers. donot use printf and scanf Honeywell4
how to check whether a linked list is circular.  3
Write out a function that prints out all the permutations of a string. For example, abc would give you abc, acb, bac, bca, cab, cba. You can assume that all the characters will be unique. Microsoft3
To Write a C program to remove the repeated characters in the entered expression or in entered characters(i.e) removing duplicates. Synergy2
Write a program that find and print how many odd numbers in a binary tree  1
why java is platform independent? Wipro6
print numbers till we want without using loops or condition statements like specifically(for,do while, while swiches, if etc)!  7
How we will connect multiple client ? (without using fork,thread) TelDNA2
Given an array of characters which form a sentence of words, give an efficient algorithm to reverse the order of the words (not characters) in it. Microsoft4
 
For more C Code Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com