Profile

Join date: May 17, 2022

About



 

Soal Tes Masuk Universitas Muhammadiyah 32


Download


 





Pada. Rajab 21/2/1915 On " the School Registration Page of the Homepage. Here it needs to be noted that the term of. Assessments of the School Registration. ''' ''' ''' ''' '''' ''' ''' ''' Section 1 . 2012/13 32 UjianTesibahasa, 2011. 35 menit J. Q: Precision of pointer arithmetic (in C) In C11 you can subtract a pointer from another, and it's guaranteed to behave like arithmetic. What if, for example, you want to store a NULL pointer? You can do this using pointer arithmetic: char* null = (char*)NULL; Now, how much will this cast affect the value of null? Will it always return NULL? In the general case, what values of ptr and ptr2 will work? A: Short answer: almost certainly not what you expect. Let's say that the value of ptr is 0x12345678. The cast is essentially equivalent to ptr-0x12345678 because of the way pointer arithmetic is defined. In practice, ptr - 0x12345678 should always be NULL, and the only way to actually get a value out of this would be to use an array initializer: int* one = (int[]){0x12345678}; In this case, one will point to the exact same place as ptr points. However, for some reason, it's allowed (or at least, I'm fairly sure I've seen it done before) to do this with pointers: int* one = (int*)NULL; It is not guaranteed to be NULL. Let's say that the value of one is 0x12345678. int* two = one - 0x12345678; What does two point to? It's not guaranteed to be NULL. It's entirely possible that 2 points to 0x12345679 (if we're lucky). If you really need to work with NULL pointers in practice, I would simply check for null pointers before I dereference them. This usually looks something like int *p; if (p) { if (*p == 0) { // Do something } } A:




da708f7a06

##TOP## Soal Tes Masuk Universitas Muhammadiyah 32

More actions

ABORIGINAL ART UK