what\'s the difference between these 2 declarations:
char (*ptr)[N];
vs.
char ptr[][N];
thanks.
1.ptr is pointer to character array of size N 2. ptr looks like a double dimensional array but number of rows is not provided.In 2-D array both number of rows and column is compulsory as compiler will decide how many bytes should be assigned to array by (number of row*number of column*size of data type).This declaration may work fine as below:
char[][2]={
{'a','b'}
};
as here compiler will look and understand that there is one row.or when a two dimensional array is passed on as a function argument,the number of columns(second dimension) must be provided by compulsion,passing number of rows is not compulsory in function definition.