[Solved] SOLVED:Assignment 1, C Pointers solution

30 $

File Name: SOLVED:Assignment_1,_C_Pointers_solution.zip
File Size: 376.8 KB

SKU: [Solved] SOLVED:Assignment 1, C Pointers solution Category: Tag:

Or Upload Your Assignment Here:


3 programs about C pointers need to be understood, like3 questions Q1, Q2, and Q3:Q1. ptr0.c (target variables: i, j, p, q, and r)Q2. ptr1.c (target variables: p, q, and array x in main())Q3. ptr2.c (target variables: i, j, and p in main())

Please use apply the 32-bit mode of GCC to compile code, e.g.,gcc -m32 ptr0.c

To make sure the size of a pointer is 4 (bytes), try a test.c:// test.c#include <stdio.hmain() {printf(“size of int * is %i
”, sizeof(int *));}

Run each of the pointer programs to see and get the output.Like what’s illustrated during class sessions, and in textbook, draw a diagram with each of the variable memory location as a rectangle box, and follow the changes in the output to fill out the boxes as the program statements go.I.e., Follow the sequence of code, draw results whenever a statement changes the contents of any locations, e.g., label addresses and fill out boxes whenever box contents get changed.

Example:// here.c#include <stdio.hmain() {int a, b, *p; a b paddr content addr content addr content83357c8 [ ? ] 83357c4 [ ? ] 83357c0 [ ? ]a = 5; [ 5 ] [ ? ] [ ? ]p = &b; [ 5 ] [ ? ] [83357c4](and so on…)}

Turn-in: hard copy, hand-written and drawn, or hand-drawn boxes mixed with computer printouts is OK.

How to login a Linux host:

Use your ECS network account and Windows “PuTTy” or Mac “terminal” appto login one of the Linux hosts designated for our assignment usages.

e.g., Mac terminal command: ssh (your username)@atoz.ecs.csus.edu

From off campus you connect to host titan or athena first, then go to one of the assignment-working host with shell command: ssh (your username)@atoz (or sp1/2/3)

Shell command to edit program, e.g., vi my.cShell command to compile program: gcc -m32 my.cShell command to run program: a.out (or ./a.out if . is not in search path)

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] SOLVED:Assignment 1, C Pointers solution
30 $