Re: Problem with 'scanf'
Re: Problem with 'scanf'
- Subject: Re: Problem with 'scanf'
- From: Ondra Cada <email@hidden>
- Date: Fri, 27 Sep 2002 01:26:57 +0200
On Thursday, September 26, 2002, at 07:34 , Jean-Baptiste Le Stang wrote:
I don't know if it's the right place to post this, but can someone tell me
why this in Project Builder is not running as it should. Thanks
I guess it does.
JB (who is trying to learn C before Obj-C)
Well, do learn C itself, but don't waste too much time on its standard
libraries: they are needed very rarely in Cocoa.
#include <stdio.h>
int main () {
int n1,n2;
printf("Enter a number\n");
scanf("%d",&n1);
printf("Enter a number\n");
scanf("%d",&n2);
return 0;
}
I took the liberty to add a code to show what happened:
132 /tmp> >q.c
#include <stdio.h>
int main () {
int n1,n2;
printf("Enter a number\n");
scanf("%d",&n1);
printf("Good! You entered %d. Enter a number\n",n1);
scanf("%d",&n2);
printf("Goodbye, second time you entered %d.\n",n2);
return 0;
}
133 /tmp> cc q.c && ./a.out
Enter a number
123
Good! You entered 123. Enter a number
314159
Goodbye, second time you entered 314159.
134 /tmp>
---
Ondra Cada
OCSoftware: email@hidden
http://www.ocs.cz
private email@hidden
http://www.ocs.cz/oc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.