The accepted convention of passing C-strings to functions is to use a pointer:
void function(char* name)
When the function modifies the string you should also pass in the length:
void function(char* name, size_t name_length)
Your first example:
char *functionname(char *name[256])
passes an array of pointers to strings which is not what you need at all.
Your second example:
char functionname(char name[256])
passes an array of chars. The size of the array here doesn’t matter and the parameter will decay to a pointer anyway, so this is equivalent to:
char functionname(char *name)
See also this question for more details on array arguments in C.
Related Posts:
- How do I properly compare strings in C?
- How to remove .html from URL?
- How to convert an int to string in C?
- What does strcmp() exactly return in C?
- C – The %x format specifier
- Trim a string in C [duplicate]
- How to remove first character from C-string?
- Standard function to replace character or substring in a char array?
- Difference between char* and char** (in C)
- How does strtok() split the string into tokens in C?
- What is lexicographical order?
- How to convert an int to string in C?
- C++ — expected primary-expression before ‘ ‘
- Regex not operator
- Regex not operator
- strdup() – what does it do in C?
- What is a string of hexadecimal digits?
- Extract a substring using PowerShell
- How to convert an int to string in C?
- Extract substring in Bash
- Regex not operator
- How to convert a string to integer in C?
- What is the difference between \r\n, \r, and \n? [duplicate]
- string to string array conversion in java
- What is the difference between \r\n, \r, and \n? [duplicate]
- Regex how to match an optional character
- What is the difference between char s[] and char *s?
- How to remove punctuation in python?
- What is the difference between a “line feed” and a “carriage return”?
- C error: undefined reference to function, but it IS defined
- Python: TypeError: cannot concatenate ‘str’ and ‘int’ objects
- Ignoring upper case and lower case in Java
- How to convert an int to string in C?
- How to replace all double quotes to single quotes using jquery?
- Convert character to ASCII numeric value in java
- Generate random string/characters in JavaScript
- How do I create an array of strings in C?
- How to trim whitespace from a Bash variable?
- Return char[]/string from a function [duplicate]
- How to check if a string is a number?
- How to get the filename without the extension from a path in Python?
- sprintf like functionality in Python
- error: expected primary-expression before ‘)’ token (C)
- Lua string.format options
- How to convert integer to string in C?
- How do you pass a function as a parameter in C?
- Alphabet range in Python
- How do I lowercase a string in C?
- How do I create an array of strings in C?
- How do you pass a function as a parameter in C?
- How do you pass a function as a parameter in C?
- How to trim whitespace from a Bash variable?
- Return char[]/string from a function
- How to clear all the elements of array in C?
- What is the difference between ‘ and ” in JavaScript?
- How do I concatenate const/literal strings in C?
- Center text in fixed-width field with stream manipulators in C++
- Split string with delimiters in C
- C# – Illegal characters in path
- \n or \n in php echo not print [duplicate]
- Mips how to store user input string
- How to create an array of strings in C?
- PadLeft function in T-SQL
- Data argument not used by format strings in C
- How to get a function name as a string?
- Anagrams finder in javascript
- Allocating string with malloc
- Reading string by char till end of line C/C++
- Removing trailing newline character from fgets() input
- Simple way to check if a string contains another string in C?
- Lua read beginning of a string
- Uncaught Error: Call to undefined function mysql_escape_string()
- struct has no member named
- How do I print my Java object without getting “SomeType@2f92e0f4”?
- How can I process each letter of text using Javascript?
- PHP to write Tab Characters inside a file?
- Proper way to empty a C-String
- Optional arguments in C function
- Does C have a string type?
- Can I define a function inside a C structure?
- Haskell: Converting Int to String
- Array type char[] is not assignable
- Lua String replace
- Parameter name omitted error?
- How to concatenate string and int in C?
- Tokenizing strings in C
- warning: return makes pointer from integer without a cast but returns integer as desired
- The difference between char * and char[] [duplicate]
- How to format strings using printf() to get equal length in the output
- C: How do I make a number always round up
- Extract filename and extension in Bash
- Meaning of #{ } in Ruby?
- realloc(): invalid next size when reallocating to make space for strcat on char *
- Split string with multiple delimiters using strtok in C
- Pointer to a string in C?
- Convert long long to string in C?
- How do I check if a string contains a certain character?
- Taking a new line using printf in java? Is %n correct?
- Convert Char to String in C
- How to count instances of character in SQL Column