I have a really funny answer
Declare variable names that are keywords in C++ but not C.
#include < stdio.h >
int main(void)
{
int old, new=3;
return 0;
}
This will compile in C, but not in C++!
Monday, July 9, 2007
Subscribe to:
Post Comments (Atom)
9 comments:
isn;t this a stupid question
yep, sounds stupid but tricky though. Btw good reply
main()
{
const int a;
printf("%u",&a);
}
this cprogram will compile in turboc++
#include"iostream.h"
void main()
{
const int a;
cout<<&a;
}
this c++program will not compile in turboc++.
1)We can assign any type of pointer to void pointer without cast in c but not in c++.
2)
int main()
{
const int i;
}
will not give error in c but in c++.
In c++ We must initlize the const variable .
You can try with const int a=0
Might will work
In c++ We must initlize the const variable .
You can try with const int a=0
Might will work
The "designated initializer" syntax in ISO C99 is not available in C++.
http://stackoverflow.com/questions/1601201/c-struct-initialization-using-labels-it-works-but-how-documentation
http://gcc.gnu.org/onlinedocs/gcc-4.4.1/gcc/Designated-Inits.html#Designated-Inits
Thanks for the info. It is very helpful.
RegardsEducational site
Get jobs info at Educational site
Hello! I simply wish to give you a big thumbs up for your excellent information
you have right here on this post. I'll be coming back to your site for more soon.
Here is my web-site - metabolic rate calculator
Post a Comment