too many arguments to function 'char* malloc()'
时间: 2024-01-19 18:05:16 浏览: 50
This error message typically occurs when you are trying to allocate memory using the malloc() function and you are passing too many arguments to the function.
The malloc() function takes only one argument, which is the size of the memory block you want to allocate in bytes. If you pass more than one argument, you will get this error.
For example, if you try to allocate memory like this:
```c
char* str = malloc(100, sizeof(char));
```
You will get the "too many arguments" error because you have passed two arguments to the malloc() function.
To fix this error, simply pass only the size argument to the malloc() function like this:
```c
char* str = malloc(100 * sizeof(char));
```
This will allocate 100 bytes of memory for the string.