Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to intialize a pointer variable ?

How to intialize a pointer variable ?

Scheduled Pinned Locked Moved C / C++ / MFC
questiontutorial
5 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sakthiu
    wrote on last edited by
    #1

    Hi all, How do i intialize a pointer variable ?

    W S R H 4 Replies Last reply
    0
    • S Sakthiu

      Hi all, How do i intialize a pointer variable ?

      W Offline
      W Offline
      Waldermort
      wrote on last edited by
      #2

      What exactly do you mean? You can initialize a pointer using the keyword new, or you can set it to point at some already allocated memory.

      1 Reply Last reply
      0
      • S Sakthiu

        Hi all, How do i intialize a pointer variable ?

        S Offline
        S Offline
        Shog9 0
        wrote on last edited by
        #3

        void* pVoid = NULL; char* pChar = NULL; int* pInt = NULL; ...

        ---- Scripts i’ve known... CPhog 1.8.2 - make CP better. Forum Bookmark 0.2.5 - bookmark forum posts on Pensieve Print forum 0.1.2 - printer-friendly forums Expand all 1.0 - Expand all messages In-place Delete 1.0 - AJAX-style post delete Syntax 0.1 - Syntax highlighting for code blocks in the forums

        1 Reply Last reply
        0
        • S Sakthiu

          Hi all, How do i intialize a pointer variable ?

          R Offline
          R Offline
          Rinu_Raj
          wrote on last edited by
          #4

          We are a bit confused in your post char* pBuff = 0; // Initialize the pointer with 0 pBuff = new char[10]; // Allocate memory for a character array of size 10 if( 0 == pBuff ) { // Failed to allocate memory } else { // Allocation successfull } Rinu Raj

          1 Reply Last reply
          0
          • S Sakthiu

            Hi all, How do i intialize a pointer variable ?

            H Offline
            H Offline
            Hamid Taebi
            wrote on last edited by
            #5

            Can you be more specific.


            WhiteSky


            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups