pointer misc

 #include <stdio.h>




int main() {


    


    int n ;


    printf("No. of students are : ");


    scanf("%d", &n);


    int marks[n];

    int *ptr = &marks[0];


    for ( int i = 0 ; i<n; i++){


        printf (" Enter marks of student %d\n : ", i +1);


        scanf("%d", &marks[i]);

        printf (" Enter marks of student ptr %p\n : ", ptr);

        

        ptr++;

        

        

        


        


    }


    


   for ( int i = 0 ; i<n; i++){


    printf(" Student %d got %d  marks \n" , i +1, marks[i]) ;

    printf(" Address of Student %d is %p \n" , i +1, ptr) ;

    ptr++;

    


   }


    return 0;


}

Comments

Popular posts from this blog

Sum of Even Numbers till N

Find the Runner-Up Score!

Print All Substrings