From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32757 invoked by alias); 10 Aug 2006 18:09:20 -0000 Received: (qmail 32743 invoked by uid 22791); 10 Aug 2006 18:09:20 -0000 X-Spam-Check-By: sourceware.org Received: from urmel-5.rz.uni-frankfurt.de (HELO chaplin.rz.uni-frankfurt.de) (141.2.22.233) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 10 Aug 2006 18:09:18 +0000 Received: from blade22-2.rz.uni-frankfurt.de ([141.2.22.192]) by chaplin.rz.uni-frankfurt.de with esmtps (TLSv1:AES256-SHA:256) (Exim 4.62) (envelope-from ) id 1GBEy3-0004l5-HA for gcc-help@gcc.gnu.org; Thu, 10 Aug 2006 20:09:15 +0200 Received: from dumbo.ghl40.whgl.uni-frankfurt.de ([141.2.119.130]) by blade22-2.rz.uni-frankfurt.de with esmtp (Exim 4.62) (envelope-from ) id 1GBEy1-0005ET-HS for gcc-help@gcc.gnu.org; Thu, 10 Aug 2006 20:09:13 +0200 Message-ID: <44DB7659.5070704@cs.uni-frankfurt.de> Date: Thu, 10 Aug 2006 18:10:00 -0000 From: Sven Eschenberg User-Agent: Thunderbird 1.5.0.5 (Windows/20060719) MIME-Version: 1.0 To: gcc-help@gcc.gnu.org Subject: Re: strings and char * References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-MailScanner: Found to be clean X-MailScanner-SpamCheck: X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2006-08/txt/msg00091.txt.bz2 Hi Michael, this is not really a gcc related question, but to shorten this: color and r differ in types, that's why you are getting an error. Regards -Sven Michael Surette wrote: > It's been a while since I've written any C code, so please forgive me if > this is a newbie type question. > > I was having a problem with a larger program when I ran into a problem. The > following code snippet should work according to what I remember of C. > What's wrong with it? > > ------------ > > char * color; > char * r="red"; > color = r; > > ------------ > > gcc -c ar.c > > ------------ > > ar.c:3: error: conflicting types for 'color' > ar.c:1: error: previous declaration of 'color' was here > ar.c:3: warning: initialization makes integer from pointer without a cast > ar.c:3: error: initializer element is not constant > ar.c:3: warning: data definition has no type or storage class > > ------------ > > gcc --version > > ------------ > > gcc (GCC) 3.4.4 > Copyright (C) 2004 Free Software Foundation, Inc. > This is free software; see the source for copying conditions. There is NO > warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. > >