Can someone help me why this code don't copy the second array to first? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can someone help me why this code don't copy the second array to first?

#include<stdio.h> #include<string.h> void copy(char *oldyear,char *newyear){ int i=0; while(*oldyear=NULL){ (*oldyear+i)==(*newyear+i); i++; *newyear++; *oldyear++; } } int main() { char s1[]="Welcome to 2018"; char s2[]="Welcome to 2019"; puts(s1); puts(s2); void copy(char s1[],char s2[]); puts(s1); puts(s2); return 0; }

31st Dec 2018, 4:54 PM
Nurullah Aydın
Nurullah Aydın - avatar
5 Answers
0
= use for assigment. == use for comparison. Re check the code if there any operator used in a wrong way. Its pretty easy to spot
31st Dec 2018, 5:40 PM
Taste
Taste - avatar
0
Really? That is the just problem of this code ? If it is,this is so annoying 😂
31st Dec 2018, 5:49 PM
Nurullah Aydın
Nurullah Aydın - avatar
0
Thank you if I can't edit correctly I will write again here. Happy new year you too :))
31st Dec 2018, 5:58 PM
Nurullah Aydın
Nurullah Aydın - avatar
0
I can't edit correctly still. Do you have chance to write full code and send to me ?
31st Dec 2018, 6:14 PM
Nurullah Aydın
Nurullah Aydın - avatar
0
Thank you a lot . Good night . Marry christmas again :)))
31st Dec 2018, 6:25 PM
Nurullah Aydın
Nurullah Aydın - avatar