Now in the above code if i want to process only the rows.. this code works fine.. if i want to send each row one by one to the function to find the key can i pass the first array element arr[0] like find_key(arr[i],len,key) in the function call?? how would i write a function prototype for that?? I want to send each row of the 2d array one by one to the function to find the key
I am really stuck as i could not understand parameter passing of...
User Profile
Collapse
-
@ashitpro
Oh yeah it works sorry silly me... i didnt check with the function names..
anyways i'll experiment with different pointer notations of passing an argument.. and if i'm stuck i'll post it here
anyways thanks a lotLeave a comment:
-
Searching an 2d array using pointers
I am using an 2d array to search for the key 32 using pointers.. Now whenever i try to compile i get an linker error saying undefined symbol find_key(int *far,int,int)..
I know the error is with the use of pointers and the way i am passing them... Can anyone help me out
...Code:#include<stdio.h> #include<conio.h> #include<stdlib.h> #define N 4 void find_key(int *,int,int); void main(){ -
Hello thanks guys for the reply and explanation..
I have got another doubt if q is an pointer to an array of 4 integers then would it hold the addresses of the first four integers in the array??
And secondly why do we need to cast it and store it in another pointer?? (i.e) in my example *p?? Cant we just dereference from q and print out the values???
I know my doubts may sound very silly but i am just learning...Leave a comment:
-
Understanding Pointers
hello.. I am learning C using the book Let US C.. I have a doubt regarding pointers... I want to pass a 2d array to a functiona nd display the elements using pointers.. the function prototype is
i want to pass the 2d arrayCode:void show(int(*q)[4],int,int);
the function definition is...Code:int a[3][4]={{1,2,3,4}, {5,6,7,8}, {9,10,11,12} }; show(a,3,4);
No activity results to display
Show More
Leave a comment: