Originally Posted by
tlovaj
New to C, so I'm kind of confused about how C works when it comes to arrays. If I'm given an array with n number of chars in it. How would I go about finding the size of the array, and then grabbing the last char of the array. I was told that C does not put a "null" at the end of an array so one could go on and on before actually finding a "\0" so I was wondering how I might do so using a for loop.
Thanks.
Try this and let us know if it works.
Code:
printf("\nArray size %d",n);
Then if the array is called "arr"
Code:
printf("\nArray last characrer value %c",arr[n-1]);