2d to 1d string copy!
hi!! i got stuck with this problem.som1 please help me out there!!
i have declared a global 2D char array namely char gnm.
and declared a 1D array in main()
In 1D array i am taking input from user in the following way
gnm[i]=nm // HERE I M STUCK I WANT TO KEEP THIS NAME IN MY 2D ARRAY.:(
WHAT SHOULD I DO........???
Re: 2d to 1d string copy!
First use code tags and more descriptive variable names.
Your var nm should be set to the size of the name nm; not the number of names expected.
You can not use the = operator on character arrays, you must use strcpy(). Or if you are just using nm for the input you could just
I also suggest that you look into std::string to replace the character arrays.
|All times are GMT +5.5. The time now is 18:43.|