Two char arrays

  • Thread starter rambo3131
  • Start date
  • #1
18
0

Main Question or Discussion Point

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).
 

Answers and Replies

  • #2
33,724
5,419
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?
 
  • #3
18
0
ı 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 .
 
  • #4
33,724
5,419
You can use scanf or gets for input. Do you know how to do input in C?
 
  • #5
rcgldr
Homework Helper
8,697
528
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.
 
  • #6
18
0
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.
 
  • #8
chiro
Science Advisor
4,790
132
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?
 
  • #9
33,724
5,419
My sense is that rambo3131 is waiting for someone to come along and write his program for him.
 
  • #10
18
0
I dont know pointers well .Do you really think that i must know pointers to solve this problem?
 
  • #11
33,724
5,419
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?
 
  • #12
18
0
yes ,i will study for a while myself .If i have a problem,i ll ask .thank you
 

Related Threads on Two char arrays

  • Last Post
Replies
4
Views
5K
Replies
1
Views
11K
Replies
4
Views
2K
  • Last Post
Replies
15
Views
3K
Replies
1
Views
2K
Replies
22
Views
1K
  • Last Post
Replies
1
Views
7K
Replies
7
Views
4K
Replies
1
Views
21K
Top