Let's provide an example. I have one main file:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "otherfile.h"
char output[1024*10];
int main(){
writeSomething(output);
return 0;
}
and another file with the function:
void writeSomething(char *o){
printf("sizeof(o)=%d", sizeof(o));
//code
memset(o,0,sizeof(o));
// code
}
While compiling this, I got the warning:
argument to 'sizeof' in 'memset' call is the same expression as the destination; did you mean to provide an explicit length?
What I want is to set the whole output
array to 0
in my function, so all 1024*10 bytes. But because I pass it as a pointer, it will only set the first 8 characters to 0
(because sizeof(o)=8
).
How can I memset the whole array trough a pointer? Is that even possible?