Computer Science, asked by komalmittal0304, 8 months ago

1. Write a C program containing two variables name and
age. Create two pointers for both the variables and
access the value through pointer. Now modify the value
of name and age to your sibling data if you have sibling
otherwise change the value of name to NULL and age to
zero.​

Answers

Answered by Anonymous
0

Answer:

/*C program to create memory for int,

char and float variable at run time.*/

#include <stdio.h>

#include <stdlib.h>

int main()

{

int *iVar;

char *cVar;

float *fVar;

/*allocating memory dynamically*/

iVar=(int*)malloc(1*sizeof(int));

cVar=(char*)malloc(1*sizeof(char));

fVar=(float*)malloc(1*sizeof(float));

printf("Enter integer value: ");

scanf("%d",iVar);

printf("Enter character value: ");

scanf(" %c",cVar);

printf("Enter float value: ");

scanf("%f",fVar);

printf("Inputted value are: %d, %c, %.2f\n",*iVar,*cVar,*fVar);

/*free allocated memory*/

free(iVar);

free(cVar);

free(fVar);

return 0;

}

Similar questions