Need know if this is right please helps anyone.
include <stdio.h>
#include <stdlib.h>
int main(){
int d, *dPtr;
char c;
int=0;
dPtr=&d;
printf("Choose one of the following:\n");
printf("a. enter a new integer value.\n");
printf("b. print a pointer address.\n");
printf("c. print the address of an integer.\n");
printf("d. print the value of an integer.\n");
scanf("%c", &c);
switch (c){
case 'a':
printf("Enter a number:");
scanf("%d, &d);
break;
case 'b':
printf("%p", dPtr);
break;
case 'c':
printf("%p", &d);
break;
case 'd':
printf("%d\n", d);
break;
}
return 0;
}
: Build a program that allows a user to select one of the following four menu options: enter new integer value, print pointer address, print integer address, and print integer value. For this program you will need to create two variables: one integer data type and one pointer. Using indirection, assign any new integer value entered by the user through an appropriate pointer.
1 answer