Question

what is the output from the following code? int number=10; int* ptr = &number; number+=10; cout<<*ptr;

what is the output from the following code?
int number=10;
int* ptr = &number;
number+=10;
cout<<*ptr;

Homework Answers

Answer #1
  • Answer for the Above question:-The output for the above following code is: 20
  • Screenshot of the above code:-
  • Output for the above code:-

Thank You..…...............................!

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
What is the output from the following code? struct   StudentType{ long id; string name; int age;...
What is the output from the following code? struct   StudentType{ long id; string name; int age; } StudentType stud1; stud1.id = 12345; stud1.name = “Josh”; stud1.age =20; StudentType* ptr = & stud1; ptr->age++; ptr->name = “John”; cout<<stud1.name<<” “ <<stud1.age;
Given the following code: int x = 0; int y = 10; int *ptr = &x;...
Given the following code: int x = 0; int y = 10; int *ptr = &x; *ptr = -55; x += -52; ptr = &y; *ptr += 52; printf("%d\n", x); What is printed to the screen?
1.    Given the following segment of code: (If there is nothing output, write None.) int x;...
1.    Given the following segment of code: (If there is nothing output, write None.) int x; int y; cin >> x; cin >> y; while (x > y) {     x -= 3;     cout << x << " "; } cout << endl;        a.    What are the output and final values of x and y when the input is 10 for x and 0 for y? [2, 2, 2]               Output                                                                                                                                                                                                    x = ______________                                                                                                                                                                                                   ...
Considering the following code fragment: #include<stdio.h> #include <stdlib.h> int base = 0; static int bonus; int*...
Considering the following code fragment: #include<stdio.h> #include <stdlib.h> int base = 0; static int bonus; int* demage (int dmg) { int* ptr = (int*) malloc(sizeof(int)); static int constant = 1;   *ptr = dmg + constant; return ptr; } int main() { int HP = 0; int* dm; base = 30; bonus = 20; for(int i=1; i<4; i++) { HP += i * base; } dm = demage(10); HP += bonus - *dm; printf("Total HP: %i", HP); return 0; } Please...
QUESTION 1 What does the following code segment output? int red, blue; red = 7; blue...
QUESTION 1 What does the following code segment output? int red, blue; red = 7; blue = red + 2 * 5 red++; blue = blue + red; cout << blue; 4 points    QUESTION 2 Is the following statement true or false? The Boolean expression in the following if statement will be true for all values of x in the range from 10 to 20 (including the endpoints) and false for all other values: int x; if (x >=...
Please find the errors of the following code a) int x[5]; int k = 10; for...
Please find the errors of the following code a) int x[5]; int k = 10; for (k = 0; k <= 5; k++) { x[k] = k -1; } b) int x[5]; for (k = 1; k <= 5; k++) { cout << x[k-1] << endl; } c) int x[5]={1,2,3,4,5}, y[5]; y = x; for (k = 0; k < 5; k++) { cout << y[k] << endl; } d) int size; cin >> size; int myArr[size];
Briefly explain what is wrong (exactly 1 error) with the following code. int num_cmb = rand()...
Briefly explain what is wrong (exactly 1 error) with the following code. int num_cmb = rand() % 6; // # of combinations int num_pmt = ( num_cmb + 1 ) % 10; // # of permutations cout << num_num_cmb; cout << num_num_pmt; double num_arng, num_drng; // # of arrangements, derangements num_arng = 2.0 / ( 1 + num_cmb - ( 1 + num_cmb ) ); num_drng = 1.5 * num_pmt; cout << num_arng; cout << num_drng;  
int main() { int item; inti; //cout << arr[i] << ";"; cin >> item; int *arr...
int main() { int item; inti; //cout << arr[i] << ";"; cin >> item; int *arr = new int[item]; // for (int x = 0; x < item; x++) // { // } for (int x = 0; x < item; x++) { cin >> arr[x]; if (x > 0) { InsertionSort(x + 1, arr); for (inti = 0; i < x + 1; i++) { cout << arr[i] << ";"; }cout << endl; } } return 0; } can...
Describe in detail any problems you see in the following code. void funcOne() {      Dog...
Describe in detail any problems you see in the following code. void funcOne() {      Dog *ptr = new Dog;      cout << “Presenting the result of a division: “ << funcDivide();      delete ptr; } int funcDivide() {     int a, b;     cin >> a >> b;     if (b == 0)       throw “Divide by Zero”;     return a / b; }
What is the output of the following code segment? public class Exception { ... static int...
What is the output of the following code segment? public class Exception { ... static int divider(int x, int y) { try { return x/y; } catch (ArrayIndexOutOfBoundsException a) { System.out.print("A"); return 1; } } static int computer(int x, int y) { try { return divider(x,y); } catch (NullPointerException b) { System.out.print("B"); } return 2; } public static void main(String args[]){ try { int i = computer (100, 0); } catch (ArithmeticException c) { System.out.print("C"); } } } ABC A...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT