- Subject: Re: [SLUG] Your top-ten linux desktop apps
- From: O Plameras <oscarp@xxxxxxxxxxx>
- Date: Tue, 27 Sep 2005 23:46:20 +1000
- Cc: slug@xxxxxxxxxxx
- User-agent: Mozilla Thunderbird 1.0.6-1.1.fc4 (X11/20050720)
Erik de Castro Lopo wrote:
You will notice that something like the Array.mapi function is
much less likely to contain errors than the C for loop.
I can modify my C-program to remove that problem in the ff. So,
as to whether a C-program is more prone to error relies on the
manner and style of coding and not intrinsic to C-language. Don't
you think ?
#include <stdio.h>
int integer_array[] = {1,-2,3,-4,5,-6,-7,8,-9,32727000};
int *ptr, *past_end, *iptr;
int main(void)
{
ptr = &integer_array[0];
iptr = ptr; printf("\n\n");
past_end = integer_array + sizeof(integer_array)/sizeof(int);
while (ptr < past_end)
{
printf("integer_array[%d] = %d ",(ptr - iptr),*ptr);
ptr++;
putchar('\n');
}
return 0;
}
--
O Plameras
http://www.acay.com.au/~oscarp/tutor