C Board  

Go Back   C Board > General Programming Boards > C Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 12-05-2008, 10:09 PM   #1
Registered User
 
Join Date: Nov 2008
Posts: 8
Unhappy How to put a string in a 2 dimensional character array?

how can you put a string into the 2 dimensional character array?

lets say you have

Code:
char array1[10][10];
char array2[10] = {"my array"};
how do you put the value of "array2" in "array1" ??
atif7865 is offline   Reply With Quote
Old 12-05-2008, 10:16 PM   #2
subminimalist
 
MK27's Avatar
 
Join Date: Jul 2008
Location: NYC
Posts: 3,944
Code:
char array1[10][10];
// array1 has ten members, 0-9.  there is no array1[10], so...
strcpy(array[9],"myarray");
__________________

Accuracy and integrity mean nothing if you don't make it past the censors...PYTHAGORAS
MK27 is offline   Reply With Quote
Old 12-05-2008, 10:26 PM   #3
Registered User
 
Join Date: Nov 2008
Posts: 8
Quote:
Originally Posted by MK27 View Post
Code:
char array1[10][10];
// array1 has ten members, 0-9.  there is no array1[10], so...
strcpy(array[9],"myarray");

Thank you so much,, You solved my problem... hehehe
atif7865 is offline   Reply With Quote
Reply

Tags
arrays, files, i/o, loop, string

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
String issues The_professor C++ Programming 7 06-12-2007 09:11 AM
Compile Error that i dont understand bobthebullet990 C++ Programming 5 05-05-2006 09:19 AM
String editor for a sentence inputted by a user - any suggestions or ideas? the_newbug C Programming 4 03-03-2006 02:11 AM
Linked List Help CJ7Mudrover C Programming 9 03-10-2004 10:33 PM
two dimensional character array feuerraeder C Programming 4 11-22-2002 08:59 AM


All times are GMT -6. The time now is 05:18 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22