Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

where can we get c/c++ version? #18

Open
SoulProficiency opened this issue Jan 28, 2024 · 3 comments
Open

where can we get c/c++ version? #18

SoulProficiency opened this issue Jan 28, 2024 · 3 comments

Comments

@SoulProficiency
Copy link

No description provided.

@i4b2c
Copy link

i4b2c commented Jan 30, 2024

Open terminal and write

For C++ version

g++ --version

For C version

gcc --version

@Knl-Bill
Copy link

For the C++ standard, you can use,

#include <bits/stdc++.h>
using namespace std;
int main()
{
cout<<__cplusplus<<"\n'
return 0;
}

C++11: __cplusplus is 201103L.
C++14: __cplusplus is 201402L.
C++17: __cplusplus is 201703L.
C++20: __cplusplus is 202002L.

And for C, you can use,

#include <stdio.h>
int main()
{
printf(__STDC_VERSION__);
return 0;
}

It will return for example 201112L for C11 version

@SoulProficiency
Copy link
Author

For the C++ standard, you can use,

#include <bits/stdc++.h>
using namespace std;
int main()
{
cout<<__cplusplus<<"\n'
return 0;
}

C++11: __cplusplus is 201103L. C++14: __cplusplus is 201402L. C++17: __cplusplus is 201703L. C++20: __cplusplus is 202002L.

And for C, you can use,

#include <stdio.h>
int main()
{
printf(__STDC_VERSION__);
return 0;
}

It will return for example 201112L for C11 version

i mean the c++ code for stream

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants