given the following declarations
int x; float y = 99.5;
write a C++ code that will cast y to an int and store the result in x.
given the following declarations int x; float y = 99.5; write a C++ code that will...
Consider the following in C
int main() { float x = 3.14, *p = &x; int r, a = 2, b[] = {5, 6, 7}; <more code here> r = Foo(x, p, &a, b) <more code here> } int Foo(float x,float y, int *z, int *w) { <Foo's code goes here> } statement in Foo result (assigned value) modify Foo's AF variables modify main's AF variables statement in Foo result (assigned value) modify Foo's AF variables modify main's AF variables...
24) A C program has the following declarations: float x = 10.0, y = 5.5, z = 2.1; int i = 3, j = 5, k = 7, m; EVALUATE each of the following expressions. SHOW YOUR WORK, including the type of each sub expression (indicating a float with a decimal point). If the expression would compile and runs but would produce garbage output, mark GARBAGE and EXPLAIN. If you are not confident of your answer, type in, compile and...
For two given array declarations: int x[3] and double y[3], which of the following is FALSE? o the memory size of x and y is same. O the last element of y is at subscript 2 O x and y are located at different memory locations o y can store the value 3.14 at any of its valid index
Given the following main program: int main() { int x; int y = 10; int z = 20; x = add(y,z); return 0; } Which function is correctly written to store the value in x? int add(int a, int b) { return a+b; } float add(float a, float b) { float x; x = a + b; return x; } void add(int y, int z) { int x; x...
Consider the following code: 1. float foo (int a, int b, int c, int d, float e) { 2. float e; 3. if (a == 0) { 4. return 0; 5. } 6. int x = 0; 7. if ((a==b) || ((c == d) && bug(a) )) { 8. x=1; 9. } 10. e = 1/x; 11. return e; 12. } Function bug(a) should return a value of true when passed a value of a=1. Build: • a test suite...
Write in C code
What to do Write a function with the following signature: float* matrix multiplication(float* left, float* right, int rows, int shared, int columns); The first two arguments are two pointers to the beginning of two matrices with the dimensions (rows,shared) and (shared, columns) correspondingly. The remaining arguments specify these dimensions. The return value will return a pointer to the very beginning of the result matrix. That said, you need to provide the space for the result matrix...
Assume you have the following variable declarations and assignments: int j2: int k3; char c'h float x2.3 Write single printf command to print the following output. The value of j is 2, and the value of x is -2.30, and the character c contains the value h. Note: You must make use of the variables as indicated by the desired output. For example, if the required output is: The value of j is 2. Then the following answer would be...
Write the output of the following segment of code and explain your results. int x=7, y=4, z; float z1, z2, z3; z1=x/y; z2=(float)(x/y); z3=(float)x/y; z=x/y; System.out.printf("z=%d z1=%5.2f z2=%5.2f z3=%5.2f \n}, z, z1, z2, z3);
After the following declarations and statements are executed: int i, j, k ; boolean c; float x, y, z; int[ ] num = {4, 1, 2, 3, 8}; i = 3; j = 5; x = 4.3; y = 58.209; c = !(i > j) ; what is the value of c
CREDITUU NAME: (8) Given the following declarations: int *pt: int size; a) Write the one statement that will dynamically allocate an integer array of size size WHICH YOU WILL WRITE TO GET USER INPUT FROM THE CONSOLE using the declarations above. b) Write the one statement that would delete the dynamically allocated array.