c and c++ programming difference-VI
By angnima
@angnima (772)
Nepal
March 4, 2007 12:30am CST
c and c++ programming difference-VI:
Implicit Assignment from void*:
You cannot implicitly assign from a void*
to any other type.
For instance,
the following is perfectly valid in C
(in fact, it's arguably the preferable
way of doing it in C)
int *x = malloc(sizeof(int) * 10);
but it won't compile in C++.
2 responses
@dholey (1383)
• India
1 May 07
instead of this we can say IN C++ WE HAVE ANOTHER BETTER METHOD FOR DYNAMIC MEMORY ALLOCATION.... in c++ a keword new is give which is not there in c....
instead of making variable (or araay) at run time we can use the following statement ;;;;;;
int *p;
p= new int[10];
any way nice to meet you ....