if array a conatins 'n' elements and array b conatins 'n-1'
elements.array b has all element which are present in array
a but one element is missing in array b. find that
element.

Answer Posted / furquan

@Rasika : It will work even for array of characters i.e.
string. It will calculate on the ascii value.

int main()
{
char a[] = "abcghs", b[] = "abchs";
int sum = 0,i;

int n = strlen(a);
for (i=0;i<n-1;i++){
sum += a[i] - b[i];
}
sum += a[i];

printf("%c\n",sum);
return 0;
}

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the benefit of using an enum rather than a #define constant?

936


How to create struct variables?

810


Why doesn't C support function overloading?

2160


What are the different types of control structures in programming?

889


What is function prototype in c language?

810


What is methods in c?

834


we need to calculating INCOME TAX for the person. The INCOME TAX is as follows:- First $10000/- of income : 4% tax Next $10000/- of income : 8% tax Next $10000/- of income : 11.5% tax above $10, 00,00/- : 15% tax What is the Solution of this Question ?

1032


What are logical errors and how does it differ from syntax errors?

919


Explain what math functions are available for integers? For floating point?

855


List some basic data types in c?

761


Why does everyone say not to use scanf? What should I use instead?

1077


what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;

2303


What are the applications of c language?

835


Can stdout be forced to print somewhere other than the screen?

843


How can I sort more data than will fit in memory?

883