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. string

string

Scheduled Pinned Locked Moved C / C++ / MFC
c++data-structurestutorialquestion
2 Posts 2 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.
  • W Offline
    W Offline
    wong1907
    wrote on last edited by
    #1

    Hello, I want to ask how to store a String in 2-D array foramt? e.g. abc[0][0]="A"; abc[0][1]="AA"; abc[0][2]="AAA"; ...... .... .. abc[n][n]="AAAAAAAAAAAAAAA"; THX!!! I am not using MFC, just the console mode!!! I think it for a long time!!!

    A 1 Reply Last reply
    0
    • W wong1907

      Hello, I want to ask how to store a String in 2-D array foramt? e.g. abc[0][0]="A"; abc[0][1]="AA"; abc[0][2]="AAA"; ...... .... .. abc[n][n]="AAAAAAAAAAAAAAA"; THX!!! I am not using MFC, just the console mode!!! I think it for a long time!!!

      A Offline
      A Offline
      Alvaro Mendez
      wrote on last edited by
      #2

      If your 2-D array will simply hold literal strings, like in your example, declare it as a 2-D array of pointers to characters, like this:

      char* abc[N][N];

      This assumes N is a predefined constant value. Regards, Alvaro Insanity: doing the same thing over and over again and expecting different results. - Albert Einstein

      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