A array contains dissimilar element how can we count,
and
A array contains dissimilar element how can we store in
another array with out repetition.

Answers were Sorted based on User's Feedback



A array contains dissimilar element how can we count, and A array contains dissimilar element ..

Answer / abby

array is a homogenous collection of elements, it cannot
contain dissimilar elements.

Is This Answer Correct ?    3 Yes 0 No

A array contains dissimilar element how can we count, and A array contains dissimilar element ..

Answer / beginner in learning c!!

An array can never contain dissimilar elements. You dont
call that derived data type as array!! so the two questions
hav NO ANSWER.. :)

Is This Answer Correct ?    4 Yes 2 No

A array contains dissimilar element how can we count, and A array contains dissimilar element ..

Answer / vadivel t

Hi this code ll work for the second question but first
question i dint understand...

here in souce buff we have 16 nos, in which 1 to 5 repeats
3 times.

but at the end of the program u ll get only nos 1 to 6 as
out in dest buff without duplicate.


Note: Compiler used Visual studio 2005.


#include<stdio.h>
#include<conio.h>
void main()
{
int source[16] = {5,3,4,1,2,1,2,3,4,5,2,3,1,5,4,6};
int dest[6], i, j, count = 0, flag;

int test = 0;
/*Copy the first element*/
dest[0] = source[0];
count++;
for(i = 1; i<= 15; i++)
{
/*Check whether the same element is already
available in the dest buff*/
for(j = 0; j<count; j++)
{
if(dest[j] == source[i])
{
/*Already available*/
flag = 0;
break;

}
else
{
flag = 1;
}
}
if(flag == 1)
{
/*The same element is not available
already - so copy it to the dest buffer*/
dest[count] = source[i];
count++;
}
}

for(i = 0; i<=5; i++)
printf("%d\t",dest[i]);

_getch();
}

Is This Answer Correct ?    1 Yes 0 No

A array contains dissimilar element how can we count, and A array contains dissimilar element ..

Answer / prakash

QUESTION WAS NOT DISSIMILAR ,BUT DIFFERENT ELEMENT LIKE,
12344214211LIKE THIS ......
TELL ME THE ANSWER

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

matrix multiplication fails introspect the causes for its failure and write down the possible reasons for its failurein c language.

5 Answers   TCS,


if (i = 0)printf ("True"); elseprintf("False"); Under what conditions will the above print out the string "True" a) Never b) Always c) When the value of i is 0 d) all of the above

0 Answers  


write a program of bubble sort using pointer?

3 Answers   TCS,


write a c/c++ program that takes a 5 digit number and calculates 2 power that number and prints it?

4 Answers  


Explain what does it mean when a pointer is used in an if statement?

0 Answers  


What is the difference between single charater constant and string constant?

0 Answers  


how to find your architecture is LittleEndian or BigEndian?

1 Answers  


4) Write a program that takes a 5 digit number and calculates 2 power that number and prints it. i have done maximum par but i m findind problem in the commented area. please help...

3 Answers  


Why Modern OS are interrupt driven?Give an example

3 Answers  


enum day = { jan = 1 ,feb=4, april, may} what is the value of may? a)4 b)5 c)6 d)11 e)none of the above

8 Answers   HCL, Wipro,


what is the similarities between. system call and library function?

1 Answers   Wipro,


What should be keep precautions while using the recursion method?

1 Answers  


Categories