COKEDUDE 27 Junior Poster in Training

If you have a counter that gets incremented through multiple functions, is it better to use a global counter or pointer counter? They both work just curious which is better and why.

Johny_2 commented: ffgfvfr +0
COKEDUDE 27 Junior Poster in Training

Which method do you usually use?

buffer[0][0] = '\0';
memset(buffer,0,strlen(buffer[0]));
memset(buffer,0,sizeof(buffer[0]));
rproffitt commented: Item 1. But Code Police may issue a ticket. +14
COKEDUDE 27 Junior Poster in Training

"is" instead of "=".

COKEDUDE 27 Junior Poster in Training

BESIDES having to do a bunch of unnecessary iterations in a for loop with strlen doesn't it also produce weird behaviors?

http://www.cprogramming.com/tips/tip/dont-use-strlen-in-a-loop-condition

The documentation uses size_t instead of int. I believe I got weird behaviors when it happened. I didn't write it down when it happened so I can't remember where to look.

http://www.cplusplus.com/reference/cstring/strlen/
http://www.tutorialspoint.com/c_standard_library/c_function_strlen.htm

rproffitt commented: Hey, I like the question. +6