pointer to string char

This is a discussion on pointer to string char within the C++ Programming forums, part of the General Programming Boards category; hello exp: char str[255]; char temp[255]="some string"; strcpy(str,"test"); please tell me how to point to the 'e' char in str ...

  1. #1
    Registered User
    Join Date
    Aug 2002
    Posts
    10

    Question pointer to string char

    hello
    exp:
    char str[255];
    char temp[255]="some string";
    strcpy(str,"test");
    please tell me how to point to the 'e' char in str variable to put it in strcat function:
    strcat(temp,pointer to 'e' char)
    thanks

  2. #2
    Registered User
    Join Date
    Mar 2003
    Posts
    169
    strcat(temp, &str[1] );
    Last edited by Scarlet7; 03-26-2003 at 08:49 AM.

  3. #3
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,681
    Also can do this I think:
    Code:
    strcat(temp,str+1);
    I used to be an adventurer like you... then I took an arrow to the knee.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. sorting number
    By Leslie in forum C Programming
    Replies: 8
    Last Post: 05-20-2009, 04:23 AM
  2. Inheritance Hierarchy for a Package class
    By twickre in forum C++ Programming
    Replies: 7
    Last Post: 12-08-2007, 03:13 PM
  3. Program using classes - keeps crashing
    By webren in forum C++ Programming
    Replies: 4
    Last Post: 09-16-2005, 03:58 PM
  4. Contest Results - May 27, 2002
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 18
    Last Post: 06-18-2002, 01:27 PM
  5. How do you search & sort an array?
    By sketchit in forum C Programming
    Replies: 30
    Last Post: 11-03-2001, 04:26 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21