
- Forum
- Programming Talk
- C and C++
- Is there Program Error
Is there Program Error
This is a discussion on Is there Program Error within the C and C++ forums, part of the Programming Talk category; Recently I and my friend came across a small C program which I have given below: #include <stdio.h> main() { ...
-
Is there Program Error
Recently I and my friend came across a small C program which I have given below:
#include <stdio.h>
main()
{
int test[10];
int b=5;
int a= b++ + array[b];
}
My friend told me the above program would give error. But I told the above program would work fine and the result of value b would be 6. Let us know who is correct. Will the program give error as my friend suggest? Kindly help us know about this.
-
06-24-2007, 01:32 AM #2
- Join Date
- May 2007
- Answers
- 12
it would give error at compile time because array is not any defined variable
-
I think you have by mistake made a typo error as array[b] instead of putting as test[b]. If t is test[b] in the statement as
int a= b++ + test[b];
Then you would have the value of b as 6 as you suggested. But if it is array[b] then it would give compile time error.
-
Sponsored Ads

Reply With Quote





