Thread: void general pointers

  1. #1
    Registered User
    Join Date
    Feb 2002

    Post void general pointers


    If I have a void pointer storing the address of an integer, how would I be able to print that integer from the void pointer?


    void main()
    	void *pntr;
    	int x = 7;
    	pntr= &x;
    	printf("%i", ????);
    I want to print the 7 using the void pointer, NOT using x anymore. All I can do is get pntr to print the address of x in integer form, but that's the furthest I can get... can anyone else help?

  2. #2
    S­énior Member
    Join Date
    Jan 2002
    printf("%i", *(int*)pntr);

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Inserting a swf file in a windows application
    By face_master in forum Windows Programming
    Replies: 12
    Last Post: 05-03-2009, 11:29 AM
  2. seg fault at vectornew
    By tytelizgal in forum C Programming
    Replies: 2
    Last Post: 10-25-2008, 01:22 PM
  3. i cannot see the mouse arrow
    By peachchentao in forum C Programming
    Replies: 6
    Last Post: 12-10-2006, 04:14 AM
  4. linked list problem
    By kzar in forum C Programming
    Replies: 8
    Last Post: 02-05-2005, 04:16 PM
  5. oh me oh my hash maps up the wazoo
    By DarkDays in forum C++ Programming
    Replies: 5
    Last Post: 11-30-2001, 12:54 PM