Now , there is a two-dimensional array a[3][4];
how to assign value by one element? for example
Code:a[1][2] = 'a'; //let the third element of the second line is equal to 'a'
Now , there is a two-dimensional array a[3][4];
how to assign value by one element? for example
Code:a[1][2] = 'a'; //let the third element of the second line is equal to 'a'
directly assign value is not right !
HOPE YOU UNDERSTAND.......
By associating with wise people you will become wise yourself
It's fine to celebrate success but it is more important to heed the lessons of failure
We've got to put a lot of money into changing behavior
PC specifications- 512MB RAM, Windows XP sp3, 2.79 GHz pentium D.
IDE- Microsoft Visual Studio 2008 Express Edition
The assignment syntax you showed was correct.
If things aren't working, then we need to see the rest of the program to see what's gone wrong.
error is as follows:Code:char snp[785][106]; //getintomemo(argv[1],snp[785][106]); copyintoarray(p,snp[785][106]); //COPYINTOARRAY: copy what the pointer points into one array void copyintoarray(char **p,char arr[785][106]) { int m,n; for ( int i = 0; i < m ; i++ && p++ ) { for ( int j = 0; j < n ; j++ && *p++ ) { char a = **p; printf("%c",a); } puts("\n"); } }
invalid conversion from `char' to `char (*)[106]'
I'm not familiar with that type of for loop. I have serious reservations about i++ && p++, and also j++ && *p++. If you want both i and p to increment, the C syntax would be:
Would that be what you wanted?Code:for(i = 0; i < yourVariable; i++, p++) { //rest of your loop code }
The compiler is saying that you're trying to treat a char, like a pointer to char, and it can't do that.
Post up your whole program - every error occurs within a context of the whole program. I'm not a good enough programmer to tell you what's wrong with code, unless I have seen that type of code, frequently.
In a whole program however, the problems can't hide nearly as well.