Question

Question 16 (4 points) Write a complete C program that declares four variables of type integer (i.e integer variables) and fo

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include<stdio.h>
#include<conio.h>
void main()
{
int a=1,b=2,c=3,d=4;
int *a_ptr,*b_ptr,*c_ptr,*d_ptr;
clrscr();
a_ptr=&a;
b_ptr=&b;
c_ptr=&c;
d_ptr=&d;
printf("\n VARIABLES\tTYPE\tVALUE\tADDRESSES\n");
printf("\n a\t\t int\t %d\t %p",a,&a);
printf("\n a_ptr\t int*\t %p\t %p",a_ptr,&a_ptr);
printf("\n b\t\t int\t %d\t %p",b,&b);
printf("\n b_ptr\t int*\t %p\t %p",b_ptr,&b_ptr);
printf("\n c\t\t int\t %d\t %p",c,&c);
printf("\n c_ptr\t int*\t %p\t %p",c_ptr,&c_ptr);
printf("\n d\t\t int\t %d\t %p",d,&d);
printf("\n d_ptr\t int*\t %p\t %p",d_ptr,&d_ptr);
getch();
}

UARIABLES TYPE VALUE ADDRESSES int int* int int* int int* int int« FFEE FFE6 FFF4 a_ptr FFF4 FFEC 2 FFF2 FFEA 3 FFFO FFEB FFF

Add a comment
Know the answer?
Add Answer to:
Question 16 (4 points) Write a complete C program that declares four variables of type integer...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a complete program that: 1) declares two local integers x and y 2) defines a...

    Write a complete program that: 1) declares two local integers x and y 2) defines a global structure containing two pointers (xptr,yptr) and an integer (z) 3) Declares a variable (mst) by the type of previous structure 4) requests the values of x and y from the user using only one scanf statement 5) sets the first pointer in the struct to point to x 6) sets the second pointer in the struct to point to y 7) uses the...

  • Homework Part 1 Write a C program that declares and initializes a double, an int, and a char. You...

    Homework Part 1 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: The address of each of the first three variables. Use the "Ox%x" format specifier to print the addresses in hexadecimal notation The value of each variable. They should equal the value you gave...

  • Write a C program to add and subtract any two given integer numbers using pointers

    1- Write a C program to add and subtract any two given integer numbers using pointers.  2- Write a C program to find the factorial using a function and pointers.  3- Write a C program to find the square of an Integer number using a function and pointers.  4- Write a C program to find the area and perimeter of a rectangle using a function and pointers.  5- Write a C program to find the larger of two integers numbers using...

  • TRUE/FALSE 1. If pl is an integer pointer variable, with the value of 1000, pl++ changes...

    TRUE/FALSE 1. If pl is an integer pointer variable, with the value of 1000, pl++ changes P1 to point to the memory location 1001. ANSWER: T 2. When you return a dynamic array to the freestore, you must include the number of elements in the array 3. You can assign an array to a pointer variable. 4. The size of dynamic arrays must be declared at compile time. 5. int *pl; declares a static variable. ANSWER: F ANSWER: F ANSWER:...

  • Please code in c 1. Write a program which does the following: Declare and initialize three...

    Please code in c 1. Write a program which does the following: Declare and initialize three pointers. One points to an integer, one points to a float and one points to a character variable Ask the user to enter appropriate values for these variables. Output the values to the screen by accessing the variables directly and then by using pointer references. Print the address of each variable. Modify the variables by performing any arithmetic operation only using pointer refer- ences...

  • Write a C program that will do the following: 1.Declare four integers variables.   intVar1, intVar2, intVar3,and...

    Write a C program that will do the following: 1.Declare four integers variables.   intVar1, intVar2, intVar3,and intVar4. 2. Initialize intVar1 to the value 4; initialize intVar2to the value 5. 3. Declare four more integer variables. exp1, exp2,exp3, and exp4. 4. Declare a character variable charVar. 5. Assign the value of each expression below to variables exp1and exp2 respectively: exp1= intVar1 + ((5 * intVar2) / (3 * intVar1)); exp2 = intVar1 + (5 * (intVar2 / 3)) * intVar1; 6....

  • Write in c and in the simplest form (beginner) Write a program pointers with multi-dimensional integer...

    Write in c and in the simplest form (beginner) Write a program pointers with multi-dimensional integer array [2] [4]. Use data set {#,88,89,90},{?,65,66,67}. Now the input characters would be converted to ASCII decimal value and put into the first cell of the row’s array, and so on. When getting the values out of the array, convert the decimal value to equivalent ASCII character. Print the address of the first array followed by the four decimal values, followed by the four...

  • Question: In C++ Write a correct and complete C++ program th... Bookmark In C++ Write a...

    Question: In C++ Write a correct and complete C++ program th... Bookmark In C++ Write a correct and complete C++ program that inputs 20 integer values from the user and performs three calculations. In the main function, input the values from the user. As part of your answer, write a sub-function, named calcAvg (), which takes two arguments and returns the average of all the integers. Also write another sub-function, named reverseArray (), which takes two arguments and reverses the...

  • WRITE A PROGRAM IN C++ THAT DECLARES AN INTEGER VECTOR V 1.)INITIALIZE THE VECTOR, V, WITH...

    WRITE A PROGRAM IN C++ THAT DECLARES AN INTEGER VECTOR V 1.)INITIALIZE THE VECTOR, V, WITH 10 INTEGERS WITH VALUES FROM 1 TO 10 2.)OUTPUT THE VECTOR IN DESCENDING ORDER, THEN ASCENDING ORDER 2.)ADD ALL THE EVEN NUMBERS 3.)ADD ALL THE ODD NUMBERS 4.)OUTPUT THE SUM OF EVEN INTEGERS 5.)OUTPUT THE SUM OF ODD INTEGERS 7.)OUTPUT THE PRODUCT OF EVEN INTEGERS 8.)OUTPUT THE PRODUCT OF ODD INTEGERS SAMPLE: Vector: 2 4 3 5 2 3 8 9 1 10 Ascending...

  • Structures in C++ :- 1. Write a program that declares a structure to store the code...

    Structures in C++ :- 1. Write a program that declares a structure to store the code number, salary and grade of an employee. The program defines two structure variables, inputs record of two employees and then displays the record of the employee with more salary. 2. Write a program that declares a structure to store the distance covered by player along with the time taken to cover the distance. The program should input the records of two players and then...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT