(Created page with "main() { int a; a=5; printf("%d %d %d\n",a,a++, a++); } asuresh@parambara:~$ icc m1.c asuresh@parambara:~$ ./a.out 7 5 6 asuresh@parambara:~$ gcc -Wall m1.c m1.c:2:1: warning...")
 
Line 1: Line 1:
main()
+
<syntaxhighlight lang="c" name="junk_1">
 +
#include<stdio.h>
 +
int main()
 
{
 
{
 
int a;
 
int a;
Line 6: Line 8:
 
}
 
}
  
asuresh@parambara:~$ icc m1.c
+
</syntaxhighlight>
asuresh@parambara:~$ ./a.out
+
 
 +
asuresh@parambara:~$ icc m1.c
 +
asuresh@parambara:~$ ./a.out
 
7 5 6
 
7 5 6
asuresh@parambara:~$ gcc -Wall m1.c
+
asuresh@parambara:~$ gcc -Wall m1.c
 
m1.c:2:1: warning: return type defaults to ‘int’ [-Wreturn-type]
 
m1.c:2:1: warning: return type defaults to ‘int’ [-Wreturn-type]
 
main()
 
main()
Line 21: Line 25:
 
}
 
}
 
^
 
^
asuresh@parambara:~$ ./a.out
+
asuresh@parambara:~$ ./a.out
 
7 6 5
 
7 6 5
  
 
(FYI- icc is Intel compiler made by Intel and gcc is GNU compiler)
 
(FYI- icc is Intel compiler made by Intel and gcc is GNU compiler)

Revision as of 15:15, 16 July 2014

<syntaxhighlight lang="c" name="junk_1">

  1. include<stdio.h>

int main() { int a; a=5; printf("%d %d %d\n",a,a++, a++); }

</syntaxhighlight>

asuresh@parambara:~$ icc m1.c
asuresh@parambara:~$ ./a.out

7 5 6

asuresh@parambara:~$ gcc -Wall m1.c

m1.c:2:1: warning: return type defaults to ‘int’ [-Wreturn-type] main() ^ m1.c: In function ‘main’: m1.c:6:29: warning: operation on ‘a’ may be undefined [-Wsequence-point] printf("%d %d %d\n",a,a++, a++); ^ m1.c:6:29: warning: operation on ‘a’ may be undefined [-Wsequence-point] m1.c:7:1: warning: control reaches end of non-void function [-Wreturn-type] } ^

asuresh@parambara:~$ ./a.out

7 6 5

(FYI- icc is Intel compiler made by Intel and gcc is GNU compiler)

main() { int a; a=5; printf("%d %d %d\n",a,a++, a++); }

asuresh@parambara:~$ icc m1.c asuresh@parambara:~$ ./a.out 7 5 6 asuresh@parambara:~$ gcc -Wall m1.c m1.c:2:1: warning: return type defaults to ‘int’ [-Wreturn-type] main() ^ m1.c: In function ‘main’: m1.c:6:29: warning: operation on ‘a’ may be undefined [-Wsequence-point] printf("%d %d %d\n",a,a++, a++); ^ m1.c:6:29: warning: operation on ‘a’ may be undefined [-Wsequence-point] m1.c:7:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ asuresh@parambara:~$ ./a.out 7 6 5

(FYI- icc is Intel compiler made by Intel and gcc is GNU compiler)