using
memset(members, 0, 255);
in general
memset(members, 0, sizeof members);
if the array is in scope, or
memset(members, 0, nMembers * (sizeof members[0]) );
if you only have the pointer value, and nMembers is the number of elements in the array.
EDIT Of course, now the requirement has changed from the generic task of clearing an array to purely resetting a string, memset
is overkill and just zeroing the first element suffices (as noted in other answers).
EDIT In order to use memset, you have to include string.h.
Related Posts:
- Convert char array to a int number in C
- Returning an array using C
- How to copy a char array in C?
- C: warning: excess elements in array initializer; near initialization for ‘xxx’ ; expects ‘char *’, but has type ‘int’
- How do I check if a string contains a certain character?
- char *array and char array[]
- Return char[]/string from a function [duplicate]
- Return char[]/string from a function
- How to print a char array in C through printf?
- Excess elements in char array initializer error
- How to initialize array to 0 in C?
- How to do scanf for single char in C
- How to properly malloc for array of struct in C
- C subscripted value is neither array nor pointer nor vector when assigning an array element value
- struct has no member named
- Initializing array of structures
- What is the difference between array and enum in C ?
- Can I create an Array of Char pointers in C?
- Excess elements of scalar initializer for pointer to array of ints
- C char array initialization
- How to allocate array of pointers for strings by malloc in C?
- char array not assignable
- The difference between char * and char[] [duplicate]
- typedef fixed length array
- Pointer to 2D arrays in C
- Initializing 2D char array in C
- Convert Char to String in C
- How do I determine the size of my array in C?
- What is an unsigned char?
- Get a substring of a char* [duplicate]
- How do I create an array of strings in C?
- Get a substring of a char*
- How to convert a char array to a string?
- Expression must be a modifiable L-value
- C: correct usage of strtok_r
- “Expected expression before ‘ { ‘ token”
- C pointers and arrays: [Warning] assignment makes pointer from integer without a cast
- What is the difference between char s[] and char *s?
- How to print the array?
- “error: assignment to expression with array type error” when I assign a struct field (C)
- Getting “conflicting types for function” in C, why?
- How do you make an array of structs in C?
- Getting “conflicting types for function” in C, why?
- Is there a function to copy an array in C/C++?
- How do I create an array of strings in C?
- Char Comparison in C
- Why am I getting “array initializer must be an initializer list or string literal”?
- What does ** do in C language?
- Using Dynamic Memory allocation for arrays
- How do I create an array of strings in C?
- How to make an array with a dynamic size? General usage of dynamic arrays (maybe pointers too)?
- Finding the length of a Character Array in C
- How to clear all the elements of array in C?
- Zero an array in C code
- Passing an array by reference in C?
- waitpid, wnohang, wuntraced. How do I use these
- Sign extend a nine-bit number in C
- Warning: assignment from incompatible pointer type
- Break statement not within loop or switch in C
- How to create an array of strings in C?
- C++ array assign error: invalid array assignment
- Cache Simulator in C
- C: error: expected ‘)’ before ‘;’ token
- Where is the C auto keyword used?
- make: Nothing to be done for `all’
- Initialization from incompatible pointer type warning when assigning to a pointer
- I’m getting “Invalid Initializer”, what am I doing wrong?
- C char* to int conversion
- Data argument not used by format strings in C
- execv vs execvp, why just one of them require the exact file’s path?
- difference between
and - expected expression before ‘{‘ token
- Setting std=c99 flag in GCC
- C Vector/ArrayList/LinkedList
- Bind failed: Address already in use
- Warning/error “function declaration isn’t a prototype”
- What is the difference between %f and %lf in C?
- warning: initializer element is not computable at load time
- What is stdin in C language?
- How to prevent multiple definitions in C?
- How to pass 2D array (matrix) in a function in C?
- error: ‘for’ loop initial declarations are only allowed in C99 mode [duplicate]
- How can you print multiple variables inside a string using printf?
- c – warning: implicit declaration of function ‘printf’
- Flushing buffers in C
- What are 0x01 and 0x80 representative of in C bitwise operations?
- Convert char array to string use C
- How to make parent wait for all child processes to finish?
- Undefined Reference issues using Semaphores
- Iterate through a C array
- What is time(NULL) in C?
- Use of cudamalloc(). Why the double pointer?
- C dynamically growing array
- Why should we check WIFEXITED after wait in order to kill child processes in Linux system call?
- char pointers: invalid conversion from ‘char*’ to ‘char’?
- How to compile makefile using MinGW?
- Mapping a numeric range onto another
- Why are hexadecimal numbers prefixed with 0x?
- Portable way to check if directory exists [Windows/Linux, C]
- OpenGL — GL_LINE_LOOP —