can't able to get output in pointer

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rampraveen
    New Member
    • Apr 2010
    • 37

    can't able to get output in pointer

    #include"main.h "
    void main()
    {
    char *address;
    char ch='a';
    address=&ch;
    clrscr();
    printf("\nvalue of ch-->%c",address) ;
    getch();
    }
    i am not able to get output..will you tell which place i have to change...if i compile there is no error is coming....will you give correct program..please .......
  • Dheeraj Joshi
    Recognized Expert Top Contributor
    • Jul 2009
    • 1129

    #2
    What you want to print? This code compiles but gives some junk result.
    If you want to pint "a" as output change your code to
    Code:
    printf("\nvalue of ch-->%c",*address);
    Regards
    Dheeraj Joshi

    Comment

    • rampraveen
      New Member
      • Apr 2010
      • 37

      #3
      Originally posted by dheerajjoshim
      What you want to print? This code compiles but gives some junk result.
      If you want to pint "a" as output change your code to
      Code:
      printf("\nvalue of ch-->%c",*address);
      Regards
      Dheeraj Joshi
      very thanks......

      Comment

      Working...