🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: es.comp.os.linux.programacion
Article #9006

Re: Problemas al compilar un programa con gcc

#9006
From: Lepton
Date: Wed, 11 Sep 2002 07:07
42 lines
1916 bytes
On Tue, 10 Sep 2002, quantium wrote:

# Buenas.
# Tengo un problema a la hora de compilar un programa, el mensaje es el
# siguiente:
# programa.c:50: warning: passing arg 2 of `strcmp' makes pointer from
# integer without a cast.

tu funcion calcular_letra devuelve un 'char', y strcmp()
compara dos strings (char[], o char*)

# /* ****** LA LINEA DE ABAJO ES LA 50 ******* */
# if(strcmp(argv[3],calcular_letra(digitos_dni))==0){
# printf("El dni es correcto");
# }

Cambialo por:

if(argv[3][0] == calcular_letra(digitos_dni)) {
	... correcto ...
}

# char calcular_letra(long int digitos_dni)
# {
#
# char
# nif[]={'T','R','W','A','G','M','Y','F','P','D','X','B','N','J','Z','S','Q','V','H','L','C','K','E','T'};

Mejor asi:

char nif[] = "TRWAGMY...";

# 	long int paso1;
# 	paso1=(digitos_dni/23)*23;
# 	return nif[digitos_dni-paso1];

Mejor:

return nif[digitos_dni % 23];

Lepton.
Technical Details
Message-ID: <Pine.LNX.4.44.0209110905130.675-100000@lorien.local>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!newsfeed.media.kyoto-u.ac.jp!newsfeed.icl.net!newsfeed.fjserv.net!feed.news.nacamar.de!fu-berlin.de!uni-berlin.de!b-180-184-180.d.dial.de.ignite.NET!not-for-mail
References: <3D7E2E32.6080209@lycos.es>

Show Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII-7-bit
X-Google-Thread: f86c8,204458febf913b0e
X-Google-Attributes: gidf86c8,public
X-Google-ArrivalTime: 2002-09-11 02:07:13 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!newsfeed.media.kyoto-u.ac.jp!newsfeed.icl.net!newsfeed.fjserv.net!feed.news.nacamar.de!fu-berlin.de!uni-berlin.de!b-180-184-180.d.dial.de.ignite.NET!not-for-mail
From: Lepton <reinob@jazzfree.com>
Newsgroups: es.comp.os.linux.programacion
Subject: Re: Problemas al compilar un programa con gcc
Date: Wed, 11 Sep 2002 09:07:25 +0200
Lines: 44
Message-ID: <Pine.LNX.4.44.0209110905130.675-100000@lorien.local>
References: <3D7E2E32.6080209@lycos.es>
NNTP-Posting-Host: b-180-184-180.d.dial.de.ignite.net (62.180.184.180)
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-Trace: fu-berlin.de 1031735231 61882774 62.180.184.180 (16 [130846])
X-Orig-Path: localhost!reinob
In-Reply-To: <3D7E2E32.6080209@lycos.es>