I have a problem with the code below.
...
int anInteger;
...
//anInteger gets a value
...
int *anotherInteger;
label = (int *)malloc(sizeof(int));
strncpy(anotherInteger, anInteger, 40);
Essentially what I want to do is to copy the value from an integer to my other integer which I have allocated memory for. Can this work with strncpy between integers or do I need another function?
Just dereference anotherInteger
.
*anotherInteger = anInteger;
strncopy
is for strings.