-3

aim: i had a requirement for accuracy i need 100 digits to be displayed

try 1: first i had used integer variable then it displayed only 10 digits

try 2: with the help of my friend i used pointers concept it successfully had input of 100 digits but pointer variable display only 10 digits

the program i had written was

#include <stdio.h>
#include <string.h>

main()
{
    int *p;
    p=(int*)malloc(100*sizeof(int));
    *p=1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890;
    printf("%d",*p);
}

on executing the above procedure i'm getting a garbage value

thanks in advance

Smart003
  • 1,119
  • 2
  • 16
  • 31

0 Answers0