adding an integer to a char array in c -



adding an integer to a char array in c -

it may silly question still not getting it. have char array char arr[100] having data

char arry[100] ---- data; int test; memcpy(&test,array+4,sizeof(int))

what memcpy skp

it re-create element array[4] variable test. on 32-bit machine sizeof(int) = 4. memcpy re-create 4 bytes address &test can hold 4 bytes.

c

Comments

Popular posts from this blog

Using Android Volley to post an array to PHP -

python - How to add an model instance to a django queryset? -

angularjs - No 'Access-Control-Allow-Origin' error from local domain to public API -