Can we write C with a C++ compiler | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can we write C with a C++ compiler

1st Aug 2021, 6:19 PM
Yassine Bensada
Yassine Bensada - avatar
7 Answers
+ 6
You can in most of the time. In sololearn, you can also do this but the scanf() won't work for taking input inside the CPP compiler in sololearn though it will work with most other compilers like cxxdroid.
1st Aug 2021, 7:02 PM
The future is now thanks to science
The future is now thanks to science - avatar
+ 4
@Athena There are also other things that don't work in cpp but works in c. An example taken from geeksforgeeks: https://code.sololearn.com/ca9a22a5A18A (gets an error) https://code.sololearn.com/ca12a3a234A2 (gets warning but works fine) There are also some other things except this. Reference : https://www.geeksforgeeks.org/write-c-program-wont-compiler-c/
1st Aug 2021, 7:09 PM
The future is now thanks to science
The future is now thanks to science - avatar
+ 3
yes
1st Aug 2021, 6:56 PM
athena
athena - avatar
1st Aug 2021, 6:57 PM
Brain & Bones
Brain & Bones - avatar
+ 2
athena as stated scanf And i also found round() wont work https://code.sololearn.com/cj1RAcNsbLsK/?ref=app
1st Aug 2021, 7:04 PM
Brain & Bones
Brain & Bones - avatar
+ 1
Brain & Bones like what?
1st Aug 2021, 6:59 PM
athena
athena - avatar
+ 1
You may use turbo C
3rd Aug 2021, 12:18 PM
Philip Lorenz DL. Sarmiento
Philip Lorenz DL. Sarmiento - avatar