Thread: arrays classes and pointers

  1. #1
    Registered User
    Join Date
    Jul 2002

    Question arrays classes and pointers

    i need help with three things cause i totally dont get them.the things are string classes and arrays.if anyone can help me out cause ive tried a buncha tutorials and books i always get stuck here so if anyone can help it would be appreciated.Oh yea and please dont get to technical.

  2. #2
    Registered User
    Join Date
    Sep 2002
    /* Edited by Mod */

  3. #3
    . Driveway's Avatar
    Join Date
    May 2002
    int myArray[10]; //starts an integer array with 11 elements 
    //because arrays start at 0
    myArray[3] = 10;
    //puts 10 into myArray[3] (the fourth element
    for(int i=0; i<11; i++)
        myArray[i] = i;
    //fills up my array with numbers
    //writes out all the elements of myArray
    //easier than writing

  4. #4
    Registered User
    Join Date
    Jul 2002


    thanks for the help on arrays anyone on strings or classes??

  5. #5
    Seeking motivation... endo's Avatar
    Join Date
    May 2002
    classes (and structs for that matter) are simply a collection of different data types. They may also include class-specific functions which are only used when handling class objects. Time for a quick example...
    class Person
       char firstName[ 30 ];
       char lastName[ 30 ]
       int age;
    That is a very simple class. The bit that says public means that the data can be accessed from outside the class, eg:
    void main( )
       Person me;
       me.firstName = "bob";     //uses the . operator to access the different bits of the Person class
       me.lastName = "builder";
       me.age = 100;
    Thast just the beginning really, if you want more just ask - theres loads to know about classes
    Couldn't think of anything interesting, cool or funny - sorry.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Q: Pointers to Classes '->' notation
    By Howie17 in forum C++ Programming
    Replies: 2
    Last Post: 12-12-2008, 10:09 AM
  2. two-dimensional dynamic array of pointers to classes
    By Timo002 in forum C++ Programming
    Replies: 4
    Last Post: 04-21-2005, 06:18 AM
  3. Pointers to Classes || pointers to structures
    By C++Child in forum C++ Programming
    Replies: 24
    Last Post: 07-30-2004, 06:14 PM
  4. Help With pointers in classes.
    By indigo0086 in forum C++ Programming
    Replies: 12
    Last Post: 10-10-2002, 02:03 PM
  5. accessing arrays with pointers
    By Nutka in forum C Programming
    Replies: 9
    Last Post: 09-30-2002, 08:19 PM