Submit | All submissions | Best solutions | Back to list |
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.
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 |
hide comments
2025-02-03 21:08:22 Simes
Is this problem supposed to illustrate the memory allocation and lack of array bound checking in C and C++ compilers? |
|
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. |
|
2011-01-25 16:53:41 vivek yadav
at my my comiler it give correct output but on spoj it give wrong answer. why??? |
|
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 |
|
2010-11-09 05:24:17 .::Manish Kumar::.
Moved to tutorial. I did not remove it, because it would draw attention towards how compiler behaves. [Simes]: WHICH compiler? Last edit: 2025-02-03 21:08:47 |
|
2010-11-09 05:24:17 Varun Jalan
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. |
|
2010-11-09 05:24:17 Shaka Shadows
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 :) |