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
- What is an unsigned char?
- Get a substring of a char*
- How to convert a char array to a string?
- C: correct usage of strtok_r
- What is the difference between char s[] and char *s?
- How do I create an array of strings in C?
- What does ** do in C language?
- How do I create an array of strings in C?
- Finding the length of a Character Array in C
- Passing an array by reference in C?
- Break statement not within loop or switch in C
- C++ array assign error: invalid array assignment
- Where is the C auto keyword used?
- I’m getting “Invalid Initializer”, what am I doing wrong?
- Bind failed: Address already in use
- Warning/error “function declaration isn’t a prototype”
- What is the difference between %f and %lf in C?
- What is stdin in C language?
- How to prevent multiple definitions in C?
- How to pass 2D array (matrix) in a function in C?
- How can you print multiple variables inside a string using printf?
- Iterate through a C array
- C dynamically growing array
- Why should we check WIFEXITED after wait in order to kill child processes in Linux system call?
- Mapping a numeric range onto another
- Why are hexadecimal numbers prefixed with 0x?
- too many arguments for format [-Wformat-extra-args]
- Comparing the values of char arrays in C++
- cast to pointer from integer of different size, pthread code
- Invalid type argument of unary ‘*’ (have ‘int’) Error in C
- Why do I get “cast from pointer to integer of different size” error?
- error: too few arguments to function `printDay’ (C language)
- Where to find the complete definition of off_t type?
- printf not printing to screen
- Still Reachable Leak detected by Valgrind
- Assembly x86 – “leave” Instruction
- What is signed integer overflow?
- When to use const char * and when to use const char []
- Double pointer array in c++
- What do numbers using 0x notation mean?
- Does stack grow upward or downward?
- Convert Little Endian to Big Endian
- error C2371: ‘functionname’ redefinition: different basic types
- How does one represent the empty char?
- How to write to a file using open() and printf()?
- note: previous implicit declaration of ‘point_forward’ was here
- Can I define a function inside a C structure?
- What exactly is meant by “de-referencing a NULL pointer”?
- getc() vs fgetc() – What are the major differences?
- Tokenizing strings in C
- Difference between char *argv[] and char **argv for the second argument to main()
- Warning: comparison of distinct pointer types
- Using cin to input a single letter into a char
- “-bash: gcc: command not found” using cygwin when compiling c?
- How to format strings using printf() to get equal length in the output
- What do \t and \b do?
- Why and when to use static structures in C programming?
- Where does linux store my syslog?
- Example of waitpid() in use?
- Can a function return two values?
- write() to stdout and printf output not interleaved?
- How to know what the ‘errno’ means?
- Split string with multiple delimiters using strtok in C
- Printf was not declared in this scope
- warning: missing terminating ” character [enabled by default]
- How to free memory from char array in C
- Can I get Unix’s pthread.h to compile in Windows?
- FFT in a single C-file
- Process exited with return value 3221225477
- malloc(sizeof(int)) vs malloc(sizeof(int *)) vs (int *)malloc(sizeof(int))
- %p Format specifier in c
- Level vs Edge Trigger Network Event Mechanisms
- variably modified array at file scope in C