Thread: work it out

  1. #1

    Unhappy work it out

    ok i have a struct within a struct and am using linked lists,


    struct subject
    char onesubject [MAXNAME];
    int num;

    struct Result
    long id;
    subject students [MAXSUBJECTS];

    do i use two pointers?
    if so could you show me an example of how i could access data members of another struct within a struct.

    Another question, what could i use to detect say ,J1234 detect the 1st number within the an array that contains those types of subject codes?

  2. #2
    Registered User
    Join Date
    Oct 2001
    Well, let's see:

    Say you have-

    Result r;

    So the first first student would be:


    and the first charachter of the subject of the first student would be:


    Searching for the first digit of a subject would require a loop:

    int i = 0;
    const char* subject = r.students[0].onesubject;
    const int length = strlen(subject);

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. strcmp returning 1...
    By Axel in forum C Programming
    Replies: 12
    Last Post: 09-08-2006, 07:48 PM
  2. getline() don't want to work anymore...
    By mikahell in forum C++ Programming
    Replies: 7
    Last Post: 07-31-2006, 10:50 AM
  3. Why don't the tutorials on this site work on my computer?
    By jsrig88 in forum C++ Programming
    Replies: 3
    Last Post: 05-15-2006, 10:39 PM
  4. fopen();
    By GanglyLamb in forum C Programming
    Replies: 8
    Last Post: 11-03-2002, 12:39 PM
  5. DLL __cdecl doesnt seem to work?
    By Xei in forum C++ Programming
    Replies: 6
    Last Post: 08-21-2002, 04:36 PM