Monday, July 27, 2009

Can we use anythingelse in place of pointers in c?

Well, it depends on what you are trying to do. Anything that can be done staticly can be done with arrays, which are really pointers in C though they don't look like them. For instance,





char a[20];


a[6] == *(a + 6); // this is always true





Even when you have something declared as a pointer you can treat it as an array to access it - as long as you have the pointer pointing to memory somewhere.

Can we use anythingelse in place of pointers in c?
Not really. If you need a pointer, you need a pointer - there is no workaround.





Rawlyn.


No comments:

Post a Comment