Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C Programming Pointers problem: Write a C program that declares and initializes a double, an int, and a char. You can initialize the variables to

C Programming Pointers problem:

Write a C program that declares and initializes a double, an int, and a char. You can initialize the variables to any legal value of your choosing. Next, declare and initialize a pointer variable to each of the variables. Using printf(), output the following:

1. The address of each of the first three variables. Use the 0x%x format specifier to print the addresses in hexadecimal notation.

2. The value of each variable. They should equal the value you gave them.

3. The memory size in bytes of each variable. Use the C sizeof() operator to get this information.

Part 2:

Add code necessary to print out the address of the variable x in function ptrLab1(), and the variable y in ptrLab2(). What do you notice? Can you explain what you are seeing?

Given example: #include

void ptrLab1(int xval)

{

int x; x = xval; /* Add the code to print the address & value of x here */

}

void ptrLab2(int dummy)

{

int y; /* Add the code to print the address & value of y here */

}

int main(void)

{

ptrLab1(7);

ptrLab2(11);

return 0;

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Formal SQL Tuning For Oracle Databases Practical Efficiency Efficient Practice

Authors: Leonid Nossov ,Hanno Ernst ,Victor Chupis

1st Edition

3662570564, 978-3662570562

Students also viewed these Databases questions

Question

6. Identify characteristics of whiteness.

Answered: 1 week ago

Question

e. What are notable achievements of the group?

Answered: 1 week ago