Warning: implode(): Invalid arguments passed in /www/wwwroot/jobquiz.info/mdiscuss.php on line 336 Which of the following statements are correct about the program below? #include<stdio.h> int main() { int size, i; scanf("%d", &size); int arr[size]; for(i=1; i<=size; i++) { scanf("%d", arr[i]); printf("%d", arr[i]); } return 0; } ?->(Show Answer!)
1. Which of the following statements are correct about the program below? #include<stdio.h> int main() { int size, i; scanf("%d", &size); int arr[size]; for(i=1; i<=size; i++) { scanf("%d", arr[i]); printf("%d", arr[i]); } return 0; }
Ask Your Doubts Here
Comments
By: guest on 01 Jun 2017 06.00 pm
The statement int arr[size]; produces an error, because we cannot initialize the size of array dynamically. Constant expression is required here. Example: int arr[10]; One more point is there, that is, usually declaration is not allowed after calling any function in a current block of code. In the given program the declaration int arr[10]; is placed after a function call scanf().