Pointer to Array

This is a discussion on Pointer to Array within the C Programming forums, part of the General Programming Boards category; Hi i need copy a text string from a pointer into an array of char. Any ideas of how to ...

  1. #1
    Registered User
    Join Date
    Apr 2006
    Posts
    5

    Question Pointer to Array

    Hi i need copy a text string from a pointer into an array of char.

    Any ideas of how to do this?

    Thanks

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,592
    Use strcpy()
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    I can't remember for the life of me how to do that. while I try to remember, search the forums.


    Quzah.
    Hope is the first step on the road to disappointment.

  4. #4
    ---
    Join Date
    May 2004
    Posts
    1,379
    Quote Originally Posted by quzah
    I can't remember for the life of me how to do that. while I try to remember, search the forums.


    Quzah.
    Subliminal messages. Do they work? We will see

  5. #5
    Registered User
    Join Date
    Mar 2006
    Posts
    725
    Or goto here.
    Code:
    #include <stdio.h>
    
    void J(char*a){int f,i=0,c='1';for(;a[i]!='0';++i)if(i==81){
    puts(a);return;}for(;c<='9';++c){for(f=0;f<9;++f)if(a[i-i%27+i%9
    /3*3+f/3*9+f%3]==c||a[i%9+f*9]==c||a[i-i%9+f]==c)goto e;a[i]=c;J(a);a[i]
    ='0';e:;}}int main(int c,char**v){int t=0;if(c>1){for(;v[1][
    t];++t);if(t==81){J(v[1]);return 0;}}puts("sudoku [0-9]{81}");return 1;}

  6. #6
    Registered User
    Join Date
    Feb 2006
    Location
    Great India
    Posts
    24
    Excuse me sir, IF you wanna get the exact and fast response for your thread , please define your problem in details not just by saying BLAH BLAH BLAH.

    Hope to get some details on this thread from you.


    REALNAPSTER

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 0
    Last Post: 05-29-2009, 05:48 AM
  2. sorting the matrix question..
    By transgalactic2 in forum C Programming
    Replies: 47
    Last Post: 12-22-2008, 02:17 PM
  3. pointer to array of structs
    By Luken8r in forum C Programming
    Replies: 2
    Last Post: 01-08-2008, 01:05 PM
  4. towers of hanoi problem
    By aik_21 in forum C Programming
    Replies: 1
    Last Post: 10-02-2004, 01:34 PM
  5. Hi, could someone help me with arrays?
    By goodn in forum C Programming
    Replies: 20
    Last Post: 10-18-2001, 09:48 AM

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