Tuesday, July 14, 2009

Can some body help me, why i am getting error in this array c pgm?plz help me.thanks in advance.?

#include%26lt;stdio.h%26gt;


{


void print(int *arr_beg, int *arr_end);





while(arr_beg! = arr_end)


{


printf("%i",*arr);


++arr_beg;


}


}





void main()


{


int arr[] = {0,1,2,3,4,5,6,7,8,9}


print(arr,arr+9);


}

Can some body help me, why i am getting error in this array c pgm?plz help me.thanks in advance.?
soem little problems with {}.. try this one:


#include%26lt;stdio.h%26gt;





void print(int *arr_beg, int *arr_end){


while(arr_beg! = arr_end)


{


printf("%i",*arr);


++arr_beg;


}


}





void main()


{


int arr[] = {0,1,2,3,4,5,6,7,8,9}


print(arr,arr+9);


}
Reply:1)instead of *arr you should write *arr_beg(in print line 3)


2) ; is missed in you main(first line)


3)correct the place of {} as the person above said


hope it helps

floral

No comments:

Post a Comment