When I compiled following code:
#include<bits/stdc++.h>
using namespace std;
long int arr[100003],flag=0;
arr[0]=-1;
int main()
{
}
I got this error: 'arr' does not name a type arr[0]=-1 Please help me with this.
When I compiled following code:
#include<bits/stdc++.h>
using namespace std;
long int arr[100003],flag=0;
arr[0]=-1;
int main()
{
}
I got this error: 'arr' does not name a type arr[0]=-1 Please help me with this.
In standard C++ it is not possible assigning variable outside of function but you can initialized it.
You can't write code outside of functions. The only things you can have outside of functions are declarations such as global variable declarations (usually a bad idea), function declarations and Macros .