python (65.1k questions)
javascript (44.2k questions)
reactjs (22.7k questions)
java (20.8k questions)
c# (17.4k questions)
html (16.3k questions)
r (13.7k questions)
android (12.9k questions)
why do i get Segmentation fault executing this code?
I'm trying to figure out the issue with this code:
int main(int argc, char *argv[])
{
char *s;
scanf("%s\n", s);
char *t = malloc(sizeof(*s) + 1);
strcpy(t, s);
t[0] = ...
Said laasri
Votes: 0
Answers: 2
I made my own strcpy function, but it is not working. How to fix it?
I attempted to make my own mystrcpy() function, which takes the same arguments as the standard function. It is not responding. The array does not get copied.
size_t Mystrlen(const char* s)
{
int i...
malscode
Votes: 0
Answers: 1
How do I read a single letter from a file when the letter has a space on either side? (C)
I'm currently working on an assignment in my Intro to C class. The assignment has us using fgets to read a single line from a file, then strcpy and strtok to take individual elements from that line an...
JakeFist26
Votes: 0
Answers: 0
Question about strcpy using char pointer in C
I'm doing some programming with C, and I have a minor problem using strcpy.
char* file="It has something inside"
int size= sizeof(file);
char* file_save = malloc(sizeof(char)*size);
strcpy(f...
lin ki
Votes: 0
Answers: 3