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 are the differences between new and malloc in C?

788


What are the types of pointers?

766


By using C language input a date into it and if it is right?

784


Not all reserved words are written in lowercase. TRUE or FALSE?

960


What is use of pointer?

764






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

899


What is scope rule of function in c?

749


Why do we use return in c?

726


Explain what is the heap?

790


Is c still used?

782


What are the disadvantages of external storage class?

781


Explain the difference between the local variable and global variable in c?

807


Explain what will be the outcome of the following conditional statement if the value of variable s is 10?

984


How was c created?

790


Can you add pointers together? Why would you?

843