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

Array

Scheduled Pinned Locked Moved C / C++ / MFC
data-structureshelptutorialquestion
11 Posts 7 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.
  • R Offline
    R Offline
    rdop
    wrote on last edited by
    #1

    Hi All I am new student to MCA.I need some example of Array.How can i store a Char type values in store and print.Plz help me

    A S R C D 5 Replies Last reply
    0
    • R rdop

      Hi All I am new student to MCA.I need some example of Array.How can i store a Char type values in store and print.Plz help me

      A Offline
      A Offline
      Arman S
      wrote on last edited by
      #2

      'Array' as such doesn't exist in C++. There are some stl containers such as std::vector, std::list and the C-style array. Please try to be more specific in your question.

      -- Arman

      R 1 Reply Last reply
      0
      • A Arman S

        'Array' as such doesn't exist in C++. There are some stl containers such as std::vector, std::list and the C-style array. Please try to be more specific in your question.

        -- Arman

        R Offline
        R Offline
        rdop
        wrote on last edited by
        #3

        ok i have char see[3]='*'; and i want to store these see values and print one by one.. Plz help me

        L 1 Reply Last reply
        0
        • R rdop

          Hi All I am new student to MCA.I need some example of Array.How can i store a Char type values in store and print.Plz help me

          S Offline
          S Offline
          SandipG
          wrote on last edited by
          #4

          I recommend you get some good book for 'C'. Your are MCA student so i think you are from India. If yes,Please have a look at "Let us C" this is very good for beginners. There are other good books also like "Schaum's Series" etc.

          Regards, Sandip.

          R 1 Reply Last reply
          0
          • R rdop

            Hi All I am new student to MCA.I need some example of Array.How can i store a Char type values in store and print.Plz help me

            R Offline
            R Offline
            raesa
            wrote on last edited by
            #5

            If you are looking for a simple c++ program to store character strings in a character array and print them, then have a look at the follwowing piece of code : void main() { char see[3][256] = {"\0" }; for (int nCntr = 0; nCntr < 3; nCntr++) sprintf (see[nCntr], "%d", nCntr); for (int nCntr = 0; nCntr < 3; nCntr++) printf ("\n%s", see[nCntr]); } Is that what you wanted??

            D 1 Reply Last reply
            0
            • S SandipG

              I recommend you get some good book for 'C'. Your are MCA student so i think you are from India. If yes,Please have a look at "Let us C" this is very good for beginners. There are other good books also like "Schaum's Series" etc.

              Regards, Sandip.

              R Offline
              R Offline
              rdop
              wrote on last edited by
              #6

              thx's

              1 Reply Last reply
              0
              • R rdop

                ok i have char see[3]='*'; and i want to store these see values and print one by one.. Plz help me

                L Offline
                L Offline
                laksh2204
                wrote on last edited by
                #7

                int main(){ char see[3]; see[0] = 's'; see[1] = 'e'; see[2] = 'e'; // or you can do above 3 steps in loop also for (int a=0; a<3; a++) { cout<<"enter a character:"; cin>>see[i]; } for(int i=0; i<3; i++) { cout<<see[i]; } return 0; } Try this and start with any of book suggested by sandip.

                1 Reply Last reply
                0
                • R rdop

                  Hi All I am new student to MCA.I need some example of Array.How can i store a Char type values in store and print.Plz help me

                  C Offline
                  C Offline
                  CPallini
                  wrote on last edited by
                  #8

                  For instance:

                  char myCharArray[]={ 'a', 'b', 'c', 'd', 'e'};
                  char c = myCharArray[3]; // now c value is 'd'

                  BTW Good C tutorial needed. :)

                  If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                  This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                  [My articles]

                  1 Reply Last reply
                  0
                  • R rdop

                    Hi All I am new student to MCA.I need some example of Array.How can i store a Char type values in store and print.Plz help me

                    D Offline
                    D Offline
                    David Crow
                    wrote on last edited by
                    #9

                    rdop wrote:

                    I am new student to MCA.

                    Unless you have 0 experience with the C language, a person pursuing a Master's degree, especially in a computer-related field, should easily be able to find this with minimal effort.

                    "Love people and use things, not love things and use people." - Unknown

                    "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

                    1 Reply Last reply
                    0
                    • R raesa

                      If you are looking for a simple c++ program to store character strings in a character array and print them, then have a look at the follwowing piece of code : void main() { char see[3][256] = {"\0" }; for (int nCntr = 0; nCntr < 3; nCntr++) sprintf (see[nCntr], "%d", nCntr); for (int nCntr = 0; nCntr < 3; nCntr++) printf ("\n%s", see[nCntr]); } Is that what you wanted??

                      D Offline
                      D Offline
                      David Crow
                      wrote on last edited by
                      #10

                      raesa wrote:

                      If you are looking for a simple c++ program...then have a look at the follwowing piece of code :

                      What part of your code is C++? :confused:

                      "Love people and use things, not love things and use people." - Unknown

                      "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

                      R 1 Reply Last reply
                      0
                      • D David Crow

                        raesa wrote:

                        If you are looking for a simple c++ program...then have a look at the follwowing piece of code :

                        What part of your code is C++? :confused:

                        "Love people and use things, not love things and use people." - Unknown

                        "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

                        R Offline
                        R Offline
                        raesa
                        wrote on last edited by
                        #11

                        I'm sorry, i mis-wrote it as 'c++', its actually 'c'.Thnx for pointing out the mistake. :-D

                        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