C Programming - Typedef - Discussion
Discussion Forum : Typedef - Find Output of Program (Q.No. 2)
2.
What will be the output of the program?
#include<stdio.h>
int main()
{
typedef int arr[5];
arr iarr = {1, 2, 3, 4, 5};
int i;
for(i=0; i<4; i++)
printf("%d,", iarr[i]);
return 0;
}
Discussion:
20 comments Page 2 of 2.
Ashok said:
7 years ago
How can it's possible because we provide just alias to the array right from 0 to 5?
Rookie said:
1 decade ago
Because the for loop is from 0.3 that's why only four elements are displayed.
Jayadev (dilu) said:
1 decade ago
Typedef used for reduce strucure component into single meaningful word.
Manisha said:
1 decade ago
Yes it is possible, because there is no multiply * symbol.
Mithi said:
1 decade ago
@Abc.
'iarr' is the array and 'i' is its index.
'iarr' is the array and 'i' is its index.
Meena said:
1 decade ago
Give me some information about typedef.
Sarada said:
1 decade ago
How come it possible? please reply.
ABC said:
1 decade ago
What does iarr[i] means?
Tanmay said:
1 decade ago
How it is ending at 3?
Sagar hudge said:
1 decade ago
How it is 1, 2, 3, 4 ?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers