Demonstrate the use of pointers In C language.
Demonstrate the use of pointers In C language.
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.
I need help to fix my code:
#include<stdio.h>
main()
{
int d=0, *dPtr;
char c;
dPtr=&d;
printf(“Menu Options:n”);
printf(“a. a new integer value.n”);
printf(“b. a pointer address.n”);
printf(“c. the address of an integer.n”);
printf(“d. the value of an integer.n”);
scanf(“%c”, &c);
switch(c){
case ‘a’:
printf(“Enter an integer:”);
scanf(“%d”, &d);
break;
case ‘b’:
printf(“%p”, dPtr);
break;
case ‘c’:
printf(“%p”, &d);
break;
case ‘d’:
printf(“%dn”, d);
break;
}
}
"You need a similar assignment done from scratch? Our qualified writers will help you with a guaranteed AI-free & plagiarism-free A+ quality paper, Confidentiality, Timely delivery & Livechat/phone Support.
Discount Code: CIPD30
Click ORDER NOW..


