Find the errors in the program segements: 1) char x = \'a\', y = \'a\'; if (strc
ID: 3554074 • Letter: F
Question
Find the errors in the program segements:
1)
char x = 'a', y = 'a';
if (strcmp(x, y) == 0)
exit(0);
2)
#include <iostream>
using namespace std;
struct ThreeVals
{
int a, b, c;
};
int main()
{
ThreeVals vals = {1, 2, 3};
cout << vals << endl;
return 0;
}
3)
struct FourVals
{
int a, b, c, d;
};
int main()
{
FourVals nums {1, 2, , 4};
return 0;
}
------------------------------------------
Look at the following code:
structure Rectangle
{
int length;
int width;
};
Rectangle *r;
Write statements that
A) Dynamically allocate a Rectangle structure variable and use r to point to it.
B) Assign 10 to the structure's length member and 14 to the structure's width member.
------------------------------------------
True or false:
In a structure variable's initialization list, you do not have to provide initializers for all the members.
The following expression refers to the element 5 in the array carInfo: carInfo.model[5]
When a function returns a structure, it is always necessary for the function to have a local structure variable to hold the member values that are to be returned.
The structure pointer operator does not automatically dereference the structure pointer on its left.
Explanation / Answer
( BEST One. Rate only after proper decision. ERRORS marked in BOLD )
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.