What is the output of the following code?main() {
static float a[] = {13.24, 1.5, 4.5, 5.4, 3.5};
float *j, *k;
j = a;
k = a + 4;
j = j * 2;
k = k / 2;
printf("%f %f", *j, *k);
}
Pick an option to check yourself, or open the answer below.
Show answer & explanation
Correct answer: D. Illegal use of pointer in main function
Explanation
Multiplication and division are not allowed on pointers in C, so j * 2 and k / 2 are compile-time errors (illegal use of pointer).More Programming Languages and Computer Graphics questions
- Which of the following is NOT an object-oriented programming language?
- What is the output of the following C program?#include <stdio.h> int main(void) { int x, *p; x = 30; p = x; printf("%d", *p); return 0; }
- Multiple inheritance is permitted directly in: A. C++ B. Java C. Python D. VB.NET E. BASIC Choose the most appropriate answer from the opti…
- Which of the following are markup languages? A. HTML B. XML C. DHTML D. LML E. PML Choose the correct answer from the options given below:
- Arrange the following in the correct order so that they follow a proper run-time environment. A. Programming statement B. Compilation C. Me…
- Match List I with List IIList I List II A. Union I. Virtual Reality B. Function II. Shadow mask C. Interactive Environment III. Subroutine…