Dear All,
I am very new to programming and really appreciate if you can help. I am using XCode as editor
My code is below:
int main (int argc, char * const argv[]) {
char a[10][25];
char *ptr_a;
ptr_a = (char *)a[10][25];
for (int index = 1; index < argc; index++)
{
std::cout << index << " " << "The value in argv[index] is : " << argv[index]<< std::
strcpy(ptr_a,argv[index]);
std::cout << index << " " << "the value of a at this point is : " << a << std::endl;
}
return 0;
}
After this when i run the program i dont get any result. Basically what i am trying to achieve here is to copy argv[index] to a[10][25] and it doesnt work. I know i am making a mistake but dont know where, would guess somethings with pointers.
Your help will be appreciated.
P.S I am new to programming and not sure if i have asked the question correctly. But on the way of learning so please do let me know if you need to some more information.
Thanks :-)