0000 Verizon 406 PM Done lab12pointerspdf d all Nol eary lan

0000 Verizon 4:06 PM Done lab12pointers.pdf d all. Nol eary language has pottets, but what you learn about methory management will apply to mos c language Unlike most of your previous labs this semester, this one will not require you to write and submit a program. This adapied from a lab used elsewhere, and it involves a good amount of guided self-explocation We\'ll give you the ri questions to ask along the way. Many of the questions will be open-ended, so when answering them, be sure to asi are not 100% sure what\'s going on! PScase use the answer sheet provided You will submit the answer sheet to V You may work The code snippets here are screenshots, so you won\'t be able to copy and paste them(sorryt) but they\'re short enou type This lab will give you the opportunity to Understand and use poinsers and poinler operations Discover the relationship between arrays, strings, and pointers Explore passing pointers as function parameters Warm Up First, let\'s practice with Pasters to basic C data types and some related pointer 4petations. We\'ll see referencing. I. Compile and run this program 1 #include 3 int aintint argc, chars argvl) \"p2; int integer!\" \"p1, 6 integert-18 p2 . 601; \",integeri) 11 12 13 printf integerl print f (\"p]s printf(\"p2\" pM\", p1); %p\ \", p2); return e 2. Suppose after the declaration of the variables on line 4, we have the following: Symbol Table Name Address x7 ttf ciff99 x7 tttecifts980 Memory Chunk (address on the left, data on the right) x7t1Bclff994 0x7ftf8clt:988 0x7ttf8citt98 Fill in the above memory chunk table to reflect the changes that lines 6 7,and 8 cause. a. b. In we substitute lines 10-12 with the following two statements, then what will be the output of the pre

Solution

b)

If we susbstitute the two lines

(*p1)++;
printf(\"Integer1=%d \ \",*p1);

then output will be Integer1=1

c) If we change the above code with these lines

integer1++;
printf(\"Integer1=%d \ \",*p1);

output will be same it will print like Integer1=1;

d) If we change the above code with these lnes

*p1++;
printf(\"Integer1=%d \ \",*p1);

The output will be different and it prints as Integer1=1075700644

e)

Here First we incremented the (*p1) which stores the value of integer.

p1=&integer1;

If we print *p1 then we get the value stored in integer1 i.e., 10.

So that`s why incrementing (*p1) and integer1 doesn`t change the output.

But in the third program we incremented *p1 which is different from(*p1) so here address will be incremented.

 0000 Verizon 4:06 PM Done lab12pointers.pdf d all. Nol eary language has pottets, but what you learn about methory management will apply to mos c language Unli

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site