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
Why is struct padding needed?
What is the use of extern in c?
What is wrong with this declaration?
Write a simple code fragment that will check if a number is positive or negative.
What is volatile variable how do you declare it?
typedef enum { html, java, javascript, perl, cgi } lang;The above statement defines a : a) Union b) User defined type c) Enumerated variable d) none
Why is sprintf unsafe?
what is the difference between class and unio?
What is static function in c?
What’s a signal? Explain what do I use signals for?
A program is required to print your biographic information including: Names, gender, student Number, Cell Number, line of study and your residential address.
Is int a keyword in c?
Can a function argument have default value?
Should I use symbolic names like true and false for boolean constants, or plain 1 and 0?
How do you list a file’s date and time?