How to use Pointers in Structure? C++
How to use Pointers in Structure? C++
This program covers the following concepts;
- structure
- pointers
- nested for loop
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
#include<iostream> using namespace std; struct counting{ int i; int j; int k=0; }; int main() { counting *count,c; count=&c; for(count->i=0;count->i<10;count->i++) { for(count->j=1;count->j<count->i;count->j++) { printf("%d",count->k); count->k++; } printf("\n"); } return 0; } |
Output