+ 4

Can I include both C and C++ header file in a same program. Does this program works?

#include <stdio.h> #include <iostream.h> using namespace std; int main(){ printf(" Hello\n"); cout<<" World"<<endl; }

3rd May 2017, 12:17 AM
Pravin
Pravin - avatar
4 odpowiedzi
+ 21
C headers are compatible in C++, so yes. You can also find the counterparts of C headers in C++, e.g. <stdio.h> is <cstdio> in C++, but the former can also be used.
3rd May 2017, 1:05 AM
Hatsy Rei
Hatsy Rei - avatar
+ 7
If you are using a c++ compiler yes. All features of c are included in c++.
3rd May 2017, 12:24 AM
buggythegret
buggythegret - avatar
+ 3
MANY programs do this so yes
8th May 2017, 4:53 AM
DeleteThisAccount