View Full Version : two char arrays
rambo3131
Apr11-11, 05:17 PM
Hi,I have a question about C.I have declared two char arrays.I want to write one string through one line to take them first array.When ı touch enter and go to next line ,it will place my charecters which have been given later touching enter to second array.What can I do this? ,please help me .(.By the way I use linux and gcc compiler and ı must take inputs from keyboard not from file).
Hi,I have a question about C.I have declared two char arrays.I want to write one string through one line to take them first array.When ı touch enter and go to next line ,it will place my charecters which have been given later touching enter to second array.What can I do this? ,please help me .(.By the way I use linux and gcc compiler and ı must take inputs from keyboard not from file).
It's not clear what you're asking.
"I want to write one string through one line to take them first array." - What does this mean?
"When ı touch enter and go to next line ,it will place my charecters which have been given later touching enter to second array." - What does this mean?
rambo3131
Apr11-11, 06:20 PM
ı mean : before ı clicked enter, i will write some charecters from keyboard .These must be taken first char array.Then, i will click enter then go to next line.Later i will write some charecters again,but this time these must be taken second char array .
You can use scanf or gets for input. Do you know how to do input in C?
I think he means he wants to copy the string from one array to the other before asking for another line of inputs. You can use strccpy() if these are zero terminated strings, or memcpy() if you know the lenghts of the strings.
rambo3131
Apr12-11, 07:18 AM
No ,ı dont mean copy.while taking input ı will write this:
abcdefg klmnfgftrgfdgdgdg dsdghbvd hhyjdsv mjkkdsdg dsrghjmd
bsxatujkolhfdsrfb fgg edfgshdh sdgsgdh gfsdgsg sgsgs ıluıuıl jyujtjdjyj
first line must be taken array 1,second line must be taken array 2.
OK, so what have you tried?
No ,ı dont mean copy.while taking input ı will write this:
abcdefg klmnfgftrgfdgdgdg dsdghbvd hhyjdsv mjkkdsdg dsrghjmd
bsxatujkolhfdsrfb fgg edfgshdh sdgsgdh gfsdgsg sgsgs ıluıuıl jyujtjdjyj
first line must be taken array 1,second line must be taken array 2.
How much knowledge do you have about pointers?
My sense is that rambo3131 is waiting for someone to come along and write his program for him.
rambo3131
Apr16-11, 05:48 PM
I dont know pointers well .Do you really think that i must know pointers to solve this problem?
A little knowledge of pointers would be helpful.
As I said in post #4, you can use scanf or gets for input. Do you know how to do input in C?
rambo3131
Apr16-11, 07:19 PM
yes ,i will study for a while myself .If i have a problem,i ll ask .thank you
vBulletin® v3.8.7, Copyright ©2000-2012, vBulletin Solutions, Inc.