Computer Science Homework Solutions
Problem
#154131

Output of Code Using Pointers

*** This is in C ***

What is the output of the following code

int x=5, y=6, *p=&x, *q=&y;
x=*q;
*p = *q + 2;
*q=x;
printf("%d %d %d %dn", x, y, *p, *q);

I think it's 5656 but these pointers confuse me.

Solution
What is this?
By OTA - Overall OTA Rating
Yupei Xiong, PhD - 4.8/5
Purchase Cost Now
$2.19 CAD (was ~$3.99)
Included in Download
  • Plain text response
$2.19 Instant Download
Add to Cart
Why you can trust BrainMass.com
  • Your Information is Secure
  • Best Online Academic Help Service
  • Students find real academic Success
Related Solutions
  • Output of code snippet - ****Answer needed in C***** What is the output of the following section of code? void A (void) { printf("A"); } void B (void) { printf("B"); A(); } void main(void) { B(); p ...
  • Statements - Show what is printed by each of the following statements. If a statement is incorrect, indicate why. a) System.out.printf("%-10dn",10000); b) System.out.printf("%cn", "this is a string"); c) Syst ...
  • What is printed in this program? - #include int main(void) { printf("Hello!n"); fclose(stdout); printf("Goodbye!n"); return0; }
  • Formatted Output - Java - Find the error(s) in each of the following program segments. Show the corrected statement. a) System.out.printf( "%sn", 'Happy Birthday' ); b) System.out.printf( "%cn", "Hello" ); c) System.out.p ...
  • What does this tell you about setting up conditional expressions in the C language? - What will be printed by the following code? int a = 3; if (a <= 5) if (a < 2) printf(“a is less than 2n”); else printf(“a is greater than 5n”); printf(“done”); Why does this occur? ...
Browse