CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Threaded View

  1. #1
    Join Date
    Mar 2009
    Posts
    23

    returning a char as a pointer

    Just after a little help here, I've shrunk the code down to keep it simpile, and I'm hoping there is an obvious reason why it wont return the character that I enter, any thoughts?? The same way seems to work for int and doubles but not for char.

    Code:
    void position (char, char *);
    
    
    int main (void);
    {
         char orientation;
         char orien;
         position(orientation, *orien);
    
         printf("Orientation is: %c", orien);
    
         
         fflush(stdin);
         getc(stdin);
         return 0;
    
    }
    
    
    void position (char orientation, char *orien)
    {
         scanf("Selection is: %c", &orientation);
         *orien = orientation;
    }
    Last edited by Vanilla_Rice; May 24th, 2009 at 05:50 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured