User Profile

Collapse

Profile Sidebar

Collapse
touches
touches
Last Activity: Nov 22 '11, 05:56 PM
Joined: Sep 9 '10
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • touches
    replied to Searching an 2d array using pointers
    in C
    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...
    See more | Go to post

    Leave a comment:


  • touches
    replied to Searching an 2d array using pointers
    in C
    @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 lot
    See more | Go to post

    Leave a comment:


  • touches
    started a topic Searching an 2d array using pointers
    in C

    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(){
    ...
    See more | Go to post

  • touches
    replied to Understanding Pointers
    in C
    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...
    See more | Go to post

    Leave a comment:


  • touches
    started a topic Understanding Pointers
    in C

    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

    Code:
    void show(int(*q)[4],int,int);
    i want to pass the 2d array
    Code:
    int a[3][4]={{1,2,3,4},
    		{5,6,7,8},
    		{9,10,11,12}
    		};
      show(a,3,4);
    the function definition is...
    See more | Go to post
No activity results to display
Show More
Working...