Thread: printing char **array;

  1. #1
    Registered User
    Join Date
    Feb 2008

    printing char **array;

    #include <stdio.h>
    int main(void)
    char **array;
     while ( **array != '\0' ){
        if (**array == '\0')
    return 0;

    This is printing the words in the array but it won't end. It creates an infinite loop. I always thought a string ended in a null character. Its like it can't find the null character. Anybody know why this would create an infinite loop?

  2. #2
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Well, this isn't real code.... please try to come up with a small, but real example that actually demonstrates the problem.

    One issue I will say right away is that you're using a char **. There is no requirement that a char ** have a terminating '\0' since it is not a string in and of itself. Also.... **array++; is probably not really what you want.

  3. #3
    Registered User
    Join Date
    Feb 2008
    I think I figured it out. Thanks anyway.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How do i un-SHA1 hash something..
    By willc0de4food in forum C Programming
    Replies: 4
    Last Post: 09-14-2005, 05:59 AM
  2. Program Crashing
    By Pressure in forum C Programming
    Replies: 3
    Last Post: 04-18-2005, 10:28 PM
  3. Half-life SDK, where are the constants?
    By bennyandthejets in forum Game Programming
    Replies: 29
    Last Post: 08-25-2003, 11:58 AM
  4. comparing fields in a text file
    By darfader in forum C Programming
    Replies: 9
    Last Post: 08-22-2003, 08:21 AM
  5. How do you search & sort an array?
    By sketchit in forum C Programming
    Replies: 30
    Last Post: 11-03-2001, 05:26 PM