Results 1 to 2 of 2

Thread: Returning a char array doesn't work :(

  1. #1
    DaoK
    Guest

    Returning a char array doesn't work :(

    why that doesn't work :

    Code:
    char[] PasswordMaker()
    {
    	char cPass[20];
    	char cChar;
    	
    	for (int i = 0 ; i < 20;i++ )
    	{
    		if ((cChar = getch()) != '\n')
    			cPass[i++] = cChar;
    		else
    			break;
    	}
    	return cPass;
    }

  2. #2
    Lively Member
    Join Date
    Aug 2001
    Posts
    109
    return a pointer to the char array.....

    Code:
    char* PasswordMaker(void)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width