#include<stdio.h>
void main()
{
int arr[ ] = {1, 2, 3, 4, 5};
int *p = arr;
printf("%d", *p++);
printf("%d", *(p+1));
}
#include<stdio.h>
void main()
{
int arr[ ] = {1, 2, 3, 4, 5};
int *p = arr;
printf("%d", *p++);
printf("%d", *(p+1));
}Find the output of the above code?
Pick an option to check yourself, or open the answer below.
Show answer & explanation
Correct answer: B. 1,3
Explanation
*p++ prints *p (1) and then moves p to arr[1]. *(p + 1) is arr[2] = 3. Output: 1 then 3.
More Programming Languages and Computer Graphics questions
- Which of the following is not an object Oriented Programming language ?
- Multiple Inheritance is permitted directly in..... A. C++ B. Java C. Python D. VB.NET E. BASIC
- Match List-I with List-II :
- For line drawing, which of the following algorithms are used ? A. DDA algorithm B. Bresenham algorithm C. Mid point algorithm D. Curve algo…
- The least values of a signed and unsigned data type variables requiring 8 bits, would be...
- Which of the following statements is TRUE?