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?
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;  
C PROGRAMMING LANGUAGE The following code written in C programming language was run and displays 997705320....
C PROGRAMMING LANGUAGE The following code written in C programming language was run and displays 997705320. Explain why and how this program outputs this number. int main(void) { int a = 5, b =20; int* ptr = &a; int** ptr2 = &ptr; printf("%d\n", ((int)*ptr * (int)*ptr2)); return 0; }
(C++ program) Use the code segment below to answer the two questions that follow. … int...
(C++ program) Use the code segment below to answer the two questions that follow. … int size = 0; cout << “Enter size: “; cin >> size; int sizeCode = size / 10; if (sizeCode == 0)    cout << “extra small”; else if(sizeCode == 1 )    cout << “small”; else if (sizeCode == 2)    cout << “medium”; else if (sizeCode == 3)    cout << “large”; else    cout << “extra large”; //end if … What would...
Consider the following program: #include #include #include using namespace std; int main() { int num1; int...
Consider the following program: #include #include #include using namespace std; int main() { int num1; int num2; cout << fixed << showpoint << setprecision(2); cout << "Enter two integers: "; cin >> num1 >> num2; cout << endl; if (num1 != 0 && num2 != 0) cout << sqrt(abs(num1 + num2) + 0.5) << endl; else if (num1 != 0) cout << floor(num1 + 0.5) << endl; else if (num2 != 0) cout << ceil(num2 + 0.5) << endl; else...
2- Use a conditional operator to fill in the underlined part of the "cout" statement to...
2- Use a conditional operator to fill in the underlined part of the "cout" statement to make the following code prints either “is equal to C++” or “is not equal to C++” depending on value of the string. Put your entire code only inside the blank spaces in parentheses and do not modify other parts of the code. (4 pts): string st; cout << "Enter a string:"; cin >> st; cout << "String " << st <<              (........................................................................................) ; 3-...
Code Example 8-1 1. int count = 1; 2. int item_total = 0; 3. int item...
Code Example 8-1 1. int count = 1; 2. int item_total = 0; 3. int item = 0; 4. while (count < 4) { 5.      cout << "Enter item cost: "; 6.      cin >> item; 7.      item_total += item; 8.      ++count; 9. } 10. int average_cost = round(item_total / count); 11. cout << "Total cost: " << item_total << "\nAverage cost: " << average_cost; (Refer to Code Example 8-1.) If the user enters 5, 10, and 15 at the prompts, the output is: Total...