Help with Arrays

This is a discussion on Help with Arrays within the C Programming forums, part of the General Programming Boards category; Code: I am tryin to store strings in an array "aqq" but when i copy to **ar and print it ...

  1. #1
    axe
    axe is offline
    Registered User
    Join Date
    Jan 2006
    Posts
    33

    Help with Arrays

    Code:
    I am tryin to store strings in an array "aqq" but when i copy to **ar and print it only prints the last element... lets strings are :
    
    we
    you
    it
    not 
     
    only prints "not" 4 times
    
       while(fgets(c,sizeof(c),fq)!=NULL)
       {
        printf("%s",c);
        aqq[count]=c;
        count++;
       }
       char **ar=aqq;
       while(*ro){
        printf("new %s",*ro);
        ro++;
       }

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,484
    Why is it so hard for you to figure out that code tags go around just the code?
    Not to mention asking the same basic question over and over in a succession of new threads (reply to an existing one).
    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
    axe
    axe is offline
    Registered User
    Join Date
    Jan 2006
    Posts
    33
    okay!! i got it!!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. pointers & arrays and realloc!
    By zesty in forum C Programming
    Replies: 14
    Last Post: 01-19-2008, 03:24 PM
  2. Replies: 16
    Last Post: 01-01-2008, 03:07 PM
  3. Need Help With 3 Parallel Arrays Selction Sort
    By slickwilly440 in forum C++ Programming
    Replies: 4
    Last Post: 11-19-2005, 09:47 PM
  4. Building B-Tree from Arrays
    By 0rion in forum C Programming
    Replies: 1
    Last Post: 04-09-2005, 02:34 AM
  5. Crazy memory problem with arrays
    By fusikon in forum C++ Programming
    Replies: 9
    Last Post: 01-15-2003, 08:24 PM

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