arrays - C Looping through pointers -


I am trying to do some simple algorithms with C but I get arrested with an issue with array poinces very quickly I have seen both of them:

And I do not think either answer my question. Say I want to create a Library function which takes the length of uncertainty as a parameter:

  void library_func (int * arr) {// I want a loop through the array while (Some_condition) {do_stuff (* arr); Arr ++; // increase indicator}}  

I do not know what I can use for "some_condition" for an indefinite length array. From one of the answers above, it seems that if I use a four array, I can compare the notification to the '\ 0' and the notification. But what about some other type of stractus?

I think the only option is:

  void library_func ( Int * arr, size_t len) {// I want to loop through the array. While (lane) {do_stuff (* arr); Arr ++; // increase indicator len--; }}  

The option you are referring to is used for the string ( '\ 0' ), to mark the end of the array To use some special int, I strongly suggest that to avoid it. The magic value '0' is easily accepted with wire, all the programmers are aware of it, and this is the ascii 'nul' value, which is the string There is no such concept for the integer as a special value accepted in the domain.

Of course, you can shorten the suggested code in the comments below.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -