vendredi 19 août 2016

Error: indirection requires pointer operand ('int' invalid) [on hold]

#include<stdio.h>
#include<conio.h>

void main(){
    int i,j,*ptr,arr[3][3];
    ptr=arr;
    printf("Enter array elements");
    for(i=0;i<3;i++){
        for(j=0;j<3;j++){ 
            scanf("%d",(*(ptr+i)+j));
        }
    }
    printf("array elements are:");
    for(i=0;i<3;i++){
        for(j=0;j<3;j++){ 
            printf("Address:%u and Value: %d",(*(ptr+i)+j),*(*(ptr+i)+j));
        }
    }
    getch();

Error is generating on line printf("Address:%u and Value: %d",(*(ptr+i)+j),*(*(ptr+i)+j));

Aucun commentaire:

Enregistrer un commentaire