Thread: Easy String position question...

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Mar 2005
    Posts
    37

    Easy String position question...

    Been out of the programming loop for awhile, and trying to ease myself back in. My first self appointed project has me stumped so thought I'd fire off a quick easy question for all the pros here on the board.

    I have a string that i have a variable in, its 26 characters long. I want to read say the 10th character in. Is there a relatively easy way to find that? Here's what i have so far:

    Code:
    #include <stdio.h>
    
    int main()
    {
            char test[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
            char single_test[] = " ";
    
            clrscr();
    
            /* Print test characters */
            printf("Variable: %s\r\n", test);
    
            /* Code here to go 10 characters out, and set the variable */
     
       /*  for ( i = 0; i < 10; ++i ) {
            single_test = strsomething  
    
            } */
        
            /* Print 10th character */
            printf("The 10th character is: %s\r\n", single_test);
    
            getch();
    
    }
    Any help would be appreciated.
    Last edited by Striph; 05-11-2009 at 03:46 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Inheritance Hierarchy for a Package class
    By twickre in forum C++ Programming
    Replies: 7
    Last Post: 12-08-2007, 04:13 PM
  2. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  3. RicBot
    By John_ in forum C++ Programming
    Replies: 8
    Last Post: 06-13-2006, 06:52 PM
  4. lvp string...
    By Magma in forum C++ Programming
    Replies: 4
    Last Post: 02-27-2003, 12:03 AM