In VS2010, the default compiler is C++, but we need test Fardad's C program.
So, I need change it.
Right click Your_Project, choose properties,
click Configration Properties, choose C/C++, choose Advanced
change the compile as default to as C code, click Apply.
It finished and I can use f5 to debug and show the console result
2010年5月31日星期一
2010年5月27日星期四
Today's Content: lazy evaluation
C compiler check 1st condition, true, jump to 2nd; false, jump out. It is called lazy evaluation
#include
int main(){
int a = 3;
int b = 1;
(a < 2 && b = b+1);
printf ("1, b : %d\n", b);
(a < 2 || b = b+1);
printf ("2, b : %d\n", b);
return 0;
}
Will output:
1, b : 1 //complier jump out
2, b : 2
#include
int main(){
int a = 3;
int b = 1;
(a < 2 && b = b+1);
printf ("1, b : %d\n", b);
(a < 2 || b = b+1);
printf ("2, b : %d\n", b);
return 0;
}
Will output:
1, b : 1 //complier jump out
2, b : 2
A tiny C compiler: TCC
TCC is a interesting and tiny C compiler.
You can download from
http://bellard.org/tcc/
You can download from
http://bellard.org/tcc/
2010年5月19日星期三
c program review: scanf function
scanf function return value:
void main()
{
int a;
int b;
int c;
printf("Enter three number: ");
int x=scanf("%d%d%d",&a,&b,&c);
printf("%d/n%d/n",a,x);
}
x is the scanf() function return value == the valid input number
if input 5 6 7 ; x is 3
if input 5 6 d ; x is 2
void main()
{
int a;
int b;
int c;
printf("Enter three number: ");
int x=scanf("%d%d%d",&a,&b,&c);
printf("%d/n%d/n",a,x);
}
x is the scanf() function return value == the valid input number
if input 5 6 7 ; x is 3
if input 5 6 d ; x is 2
订阅:
博文 (Atom)