ARR - ARRAY(EASY)
Replace "?" with a integer so that output is 4.
int main() { int arr[7]; int b,c,d,a; a=4; printf("%d",arr[?]); return 0; }
Input
No input.
Output
Write only one integer as the answer. And submit as TEXT.
Note: Don't submit whole program and assume no optimization by compiler.
hide comments
|
Simes:
2025-02-03 21:08:22
Is this problem supposed to illustrate the memory allocation and lack of array bound checking in C and C++ compilers? |
|
nadstratosfer:
2018-05-26 17:29:55
Useless problem. Last AC submission 4.5 years ago -- the number I get with every compiler gets WA here. Please delete this. |
|
vivek yadav:
2011-01-25 16:53:41
at my my comiler it give correct output
|
|
যোবায়ের:
2010-12-17 14:12:26
I use many different local and online compiler and could not manage it to print 4 with arr[x] where, x is the integer I got AC with, so, its all about "how compiler behaves" or more specifically "how compiler allocates memory" :p |
|
.::Manish Kumar::.:
2010-11-09 05:24:17
Moved to tutorial.
|
|
Varun Jalan:
2010-11-09 05:24:17
Move it to the tutorial section or even better remove it altogether. Firstly it does not test any particular feature of the C language, and is not standard. Also, some compilers would optimise and not allocate b,c,d, while some would. |
|
Shaka Shadows:
2010-11-09 05:24:17
The problem has been designed considering just a particular compiler. Mine, which is gcc/g++ 4.4 never outputs 4 with the output value. So, a small hint: think as a compiler and forget about yours :) |
Added by: | .::Manish Kumar::. |
Date: | 2010-11-08 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | TEXT |
Resource: | own problem |