0 votes 0 votes #include<Stdio.h> main() { int *a[10]; *a[0]=323; printf("%d",*a); } // i m getting error what is error here ? Wanted asked Jan 12, 2017 Wanted 567 views answer comment Share Follow See all 11 Comments See all 11 11 Comments reply saurabh rai commented Jan 12, 2017 reply Follow Share address assignment is missing here 0 votes 0 votes Wanted commented Jan 12, 2017 reply Follow Share give me answer of thiz main () { int *a[]; } if i use a[2][3]; is it valid ? 0 votes 0 votes saurabh rai commented Jan 12, 2017 reply Follow Share ur code is nt correct bcoz u r declaring an array ie of pointers but u r nt assigning any address 2 it nd u want 2 access the elements through it it is same like int* a, print *a 0 votes 0 votes Wanted commented Jan 12, 2017 reply Follow Share ya i got what are mistake in it . but i asked another question ...give answr plz 0 votes 0 votes saurabh rai commented Jan 12, 2017 reply Follow Share yes then u can use it as a[2][3]= *(*(a+2)+3) 0 votes 0 votes Wanted commented Jan 12, 2017 reply Follow Share can u write full formula with means e.g. int *a[10]; a element 1000 1200 1300 1400 1500 1600 1700 1800 a index 0 1 2 3 4 5 6 7 memory 100 102 104 106 108 110 112 114 location no how to calculate a[2][1] ? according to u it will *(*(a+2)+1) = first i will solve inner part a+2 which wil 100+2 * size of type (here int , so 2 ) a+2 leads to 100+4 = 104 *104 leads 1300 so *(1300 + 1) which leads 1300 + 2 = 1302 vaue at 1302 which leads here error //bcz there is no element at memory location is thiz whole scenario is right ? 0 votes 0 votes saurabh rai commented Jan 12, 2017 reply Follow Share yes i think u r right it is right if elements r contiguous suppose each element of array of pointers pointing to each element of an array then it may right bt nt ever as in ur case srry if any problem occur due 2 me... https://www.tutorialspoint.com/cprogramming/c_array_of_pointers.htm 1 votes 1 votes saurabh rai commented Jan 12, 2017 reply Follow Share https://gateoverflow.in/893/gate2003-2 0 votes 0 votes Wanted commented Jan 12, 2017 reply Follow Share my question is modification of that question :) –1 votes –1 votes srestha commented Jan 12, 2017 reply Follow Share valid code is this int main(void) { int *a[10]; a[0]=323; printf("%d",a[0]); return 0; } 0 votes 0 votes Wanted commented Jan 12, 2017 reply Follow Share srestha tell , below description is right ? can u write full formula with means e.g. int *a[10]; a element 1000 1200 1300 1400 1500 1600 1700 1800 a index 0 1 2 3 4 5 6 7 memory 100 102 104 106 108 110 112 114 location no how to calculate a[2][1] ? according to u it will *(*(a+2)+1) = first i will solve inner part a+2 which wil 100+2 * size of type (here int , so 2 ) a+2 leads to 100+4 = 104 *104 leads 1300 so *(1300 + 1) which leads 1300 + 2 = 1302 vaue at 1302 which leads here error //bcz there is no element at memory location is thiz whole scenario is right ? –1 votes –1 votes Please log in or register to add a comment.