File Edit View Window Help Home Tools | 111% 2. Add the code necessary to progra
ID: 3593119 • Letter: F
Question
File Edit View Window Help Home Tools | 111% 2. Add the code necessary to program hwpointers 02.c to print the information shown below. Print the address of dval, pdval and pdval. Print the data stored in each of these locations. For the address of the expression pdval, use & pdval. Your addresses will be different. (5 points ) Desktop bash-80x24 Desktopbash dianes-MacBook-Air:Desktop dianes /a.out Name dval pdval *pdvat Stored Data 3.148008 0x7fff5af7bb58 3.140008 Address 0x7fff5af7bb48 dianes-MacBook-Air: Desktop dianes IExplanation / Answer
//Please see the code below:
#include<stdio.h>
int main()
{
double dval=3.14;
double *pdval =&dval;
printf("Name Address Stored Data ");
printf("dval 0x%x %f ",&dval,dval);
printf("pdval 0x%x 0x%x ",&pdval,pdval);
printf("*pdval 0x%x %f ",&*pdval,*pdval);
return 0;
}
OUTPUT:
Name Address Stored Data
dval 0x43fb8043fb80 3.140000
pdval 0x43fb7443fb74 0x43fb8043fb80
*pdval 0x43fb8043fb80 3.140000
2)
#include<stdio.h>
int main()
{
unsigned int arr[20]={0,};
int i;
for(i=0;i<20;i++)
{
//Used pointer to access the array
*(arr+i)=i;
}
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.