KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
int main() { int (*x)[5]; //pointer to an array of integers int y[6] = {1,2,3,4,5,6}; //array of integers int *z; //pointer to integer z = y; for(int i=0;i<6;i++) printf("%d ",z[i]); x = y; for(int i=0;i<6;i++) printf("%d ",(*x)[i]); return 0; } Both the above printfs print numbers 1 through 6. If both " pointer to array of integers " and " pointer to integer " can do the same thing, do they have the same internal representation? EDIT: This code does give warnings when compiled as pointed out by the answers below, however it does print the values correctly both the time on my x86_64 machine using gcc
Tags (comma-separated)
Save Edits
Cancel