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
How can I find out if there are characters available for reading?
What are the string functions? List some string functions available in c.
Explain what is a static function?
What is the difference between array_name and &array_name?
Is r written in c?
write a program to concatenation the string using switch case?
Write a program to swap two numbers without using third variable in c?
What are valid operations on pointers?
What are type modifiers in c?
Explain what are global variables and explain how do you declare them?
What is the collection of communication lines and routers called?
Given below are three different ways to print the character for ASCII code 88. Which is the correct way1) char c = 88; cout << c << " ";2) cout.put(88);3) cout << char(88) << " "; a) 1 b) 2 c) 3 d) constant
Are there namespaces in c?
What is the code for 3 questions and answer check in VisualBasic.Net?
What are local static variables? How can you use them?