0

How this program works?

main() { int c[ ]={2.8,3.4,4,6.7,5}; int j,*p=c,*q=c; for(j=0;j<5;j++) { printf(" %d ",*c); ++q; } for(j=0;j<5;j++){ printf(" %d ",*p); ++p; } } And the output is 2222223465 How it prints this much 2? Please say the flow of this program

13th Jul 2021, 2:40 PM
Durga M
Durga M - avatar
3 Answers
+ 2
Martin, I can't help but wonder why the compiler didn't say a thing when floating point literals was used to initialize an int array. Why is that?
13th Jul 2021, 3:17 PM
Ipang