Noushad Bhuiyan
Noushad Bhuiyan

Reputation: 11

How to declare a long long int array in C90

I'm troubling with my C90 compiler as it's showing error in long long int. I want to declare an long long int type array.

Is there any other way to compile it with C90?

Here is my code:

#include<stdio.h>

int main()
    {
        int i,n,j,X;
        long long int N[60];
        N[0]=0;
        N[1]=1;
        for(i=2;i<61;i++)
        {
            N[i]=N[i-1]+N[i-2];
        }
        scanf("%d",n);
        for(j=0;j<n;j++)
        {
         scanf("%d",X);
         printf("Fib(%d) = %lld",X,N[X]);

        }
    }

Upvotes: 1

Views: 1996

Answers (1)

Lundin
Lundin

Reputation: 214060

Unless you can find some non-standard pre-processor extension, then no you can't use long long in C90.

Though if you are lucky, the compiler implements stdint.h where you can find int64_t. Some C90 compilers like Visual Studio 2017 does this.

Given that great C99 or C11 compilers are available free of charge, for a whole lot of different systems, there should be no reasons to sticking with C90.

Upvotes: 1

Related Questions