Thread: pointer to string char

  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
    Location
    UK
    Posts
    170
    strcat(temp, &str[1] );
    Last edited by Scarlet7; 03-26-2003 at 09:49 AM.

  3. #3
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,817
    Also can do this I think:
    Code:
    strcat(temp,str+1);
    "Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
    -Christopher Hitchens

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, 04: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, 05:26 PM