Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Message-ID: <008f01c048fb$f3198120$e6fefea9@sto.zaz.com.br> From: "Keyser Soze" To: Subject: Newbie half off topic: '*' substituted by 'c' Date: Tue, 7 Nov 2000 18:47:29 -0200 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_008B_01C048EB.2E735A40" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 ------=_NextPart_000_008B_01C048EB.2E735A40 Content-Type: multipart/alternative; boundary="----=_NextPart_001_008C_01C048EB.2E735A40" ------=_NextPart_001_008C_01C048EB.2E735A40 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I made a simple code to examplify, a calculation program, but when you = do: "conta 2 * 4" it doesn't do the multiplication, after making a = printf call to see what argc[2] contains, it appears 'c'. Anyone knows what is happening? Keyser Soze ------=_NextPart_001_008C_01C048EB.2E735A40 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
I made a simple code to examplify, a calculation = program, but=20 when you do: "conta 2 * 4" it doesn't do the multiplication, after = making a=20 printf call to see what argc[2] contains, it appears 'c'.
Anyone knows what is happening?
 
Keyser Soze
------=_NextPart_001_008C_01C048EB.2E735A40-- ------=_NextPart_000_008B_01C048EB.2E735A40 Content-Type: application/octet-stream; name="conta.c" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="conta.c" #include main(int argv, char *argc[]){ int num1, num2; char oper; if(argv < 4) { printf("\nWRONG!!!\n%s num1 oper num2", argc[0]); return(-1); } num1 = atoi(argc[1]); num2 = atoi(argc[3]); oper = *argc[2]; switch(oper){ case '+': printf("\n %d\n", num1 + num2); break; case '-': printf("\n %d\n", num1 - num2); break; case '*': printf("\n %d\n", num1 * num2); break; case '/': printf("\n %d\n", num1 / num2); break; default: printf("\n %c nao e operador",oper); break; } return 0; } ------=_NextPart_000_008B_01C048EB.2E735A40 Content-Type: text/plain; charset=us-ascii -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com ------=_NextPart_000_008B_01C048EB.2E735A40--