Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,895 questions

51,826 answers

573 users

How to get the current runtime version in C

2 Answers

0 votes
#include <stdio.h>

int main() {
    #if __STDC_VERSION__ >= 201710L
        printf("C18 (or later) is being used.\n");
    #elif __STDC_VERSION__ >= 201112L
        printf("C11 is being used.\n");
    #elif __STDC_VERSION__ >= 199901L
        printf("C99 is being used.\n");
    #else
        printf("C89/C90 is being used.\n");
    #endif

    return 0;
}



/*
run:

C18 (or later) is being used.

*/

 



answered Jul 2, 2025 by avibootz
0 votes
#include <stdio.h>

int main() {
    printf("C Standard Version: ");
    #if __STDC_VERSION__ == 199901L
        printf("C99\n");
    #elif __STDC_VERSION__ == 201112L
        printf("C11\n");
    #elif __STDC_VERSION__ == 201710L
        printf("C17 (or C18)\n");
    #else
        printf("Pre-C99 or unknown (%ld)\n", __STDC_VERSION__);
    #endif

    return 0;
}


/*
run:

C Standard Version: C17 (or C18)

*/

 



answered Jul 2, 2025 by avibootz

Related questions

1 answer 61 views
2 answers 69 views
2 answers 90 views
2 answers 94 views
1 answer 76 views
3 answers 92 views
...