Homework:
1) Given the following declaration :
Int var1 = 9;
Int var2 = 6;
Int *varPtr1 = &var1;
Int *varPtr2 = &var2;
a) What are the value of var1 and var2 after the following code sequence?
Temp = *varPtr1;
*varPtr1 = *varPtr2;
*varPtr2 = temp;
b) what did this sequence accomplish?
b) above program accomplish swaping operation by using
pointers.By using pointers instead of value we can access the
address of the variable.it makes faster the operation.
Homework: 1) Given the following declaration : Int var1 = 9; Int var2 = 6; Int...
#include "stdio.h" #include <iostream> int main() { unsigned char var1 = 4; unsigned short int var2 = 255; unsigned short int var3 = 16; unsigned int var4 = 1; asm_ MOV AL, var1; MOV AX, var2; MOV AX, var3; MOV EBX, var4; MOVZX ECX, AX; What is the hexadecimal value of BX?
in python Is the following line of code correct? var1, var2, var3 = 1, '2', 3 a. True b. False
Solve using C programming
3. lf you are given this code. #include <stdio.h> int main() int var1, var2; int sum; printf("Enter number 1:\n "); scanf("%d",&var1); printf("Enter number 2:In ); scanf("%d",&var2); sum-var1+var2; printf ("Vnsum of two entered numbers : %d", //printf ("Output: %d", res); sum); return e; Modify this code by creating a function called "addition". Make the arguments of the functions numberl and number 2. Add the two values in the function. Return a value called "result". Print "result" in...
How do i convert the following C program into MIPS assembly? int main(void) { short var1[4] ={5, 8, 13, 6}; short var2[4]= {16, 4, 7, 15}; short result[4]={0}; for (int i=0 ; i< 4; i++) result[i] = var1[i] - var2[i]; }
Consider the following AVR Assembly Language Code which is
passed through an assembler.
.include "m324Adef.inc"
jmp RESET
jmp HANDLER_1
.dseg
var1: .BYTE 2
var2: .BYTE 6
.cseg
const: .DB 0xAA, 0xCC, 0xDD
reset:
ldi ZL, low(var1)
ldi ZH, high(var1)
ldi r17, 0xBB
st Z, r17
ldi ZL, low(const<<1)
ldi ZH, high(const<<1)
lpm
jmp mainloop
.dseg
var3: .BYTE 4
.cseg
.org 0x15
mainloop:
ldi r20, 0xF0
...
Determine the segments and values of each of the following symbols.
(Enter the segment...
C# 1.)Using the following declaration: int [ , ] exampleArray = {{3, 5, 6, 7}, {2, 8, 9, 22}, {1, 0, 4, 11}}; ______________ would be displayed if the following output statement was executed. WriteLine(exampleArray.Rank); 2.)Using the following declaration: int [ , ] exampleArray = {{3, 5, 6, 7}, {2, 8, 9, 22}, {1, 0, 4, 11}}; ______________ would be displayed if the following output statement was executed. WriteLine(exampleArray[0, 2]); 3.) Using the following declaration: int [ , ] exampleArray...
C++ Help: Given the following code int num[30] = {2, 4, 6, 9, 5, -1, 7, 10}; Show the value of: a. num[3] + num[4] b. num[6] c. num[9] + 1 d. num[30]
What will be the value of the parity flag after the following lines execute? Mov al, 3 Add al, 5 What will be the value of the destination operand after each of the following instructions execute? .data var1 SBYTE -1, -2, -3, -4 var2 WORD A000h, B000h, C000h, D000h var3 SWORD -16, -42 var4 DWORD 11, 22, 33, 44 .code mov ax, var2 mov ax, [var2+4] mov ax, var3 mov ax, [var3-2]
C language not C++
1. Write the statements to do the following: (2 pts) a. Define a struct with member variables width, height, topleft x, topleft y all floats). Use a tag to call it Rectangle. b. Declare a variable struct type Rectangle 2. Consider the following variables: struct int x; float y; char zi var1; union nt x; float y; char[20] z;) var2 f float and int are stored using 4 bytes each, what is the size (in bytes)...
Arrays C++ #include <iostream> using namespace std; int main() { int tests[6]; // array declaration int sum = 0; float avg; //input test scores cout << " Enter " << 6 << " test scores: " << endl; for (int i = 0; i < 6; i++) { cout << "Enter Test " << i + 1 << ": "; cin >> tests[i]; } return 0; } Type...