Code:
#include <stdlib.h>
void copy1( char *s1, const char *s2 );
int main(){
char *str="Hello";
char Wordarray[5] ;
int a;
char m;
copy1(Wordarray, str);
for (a=0;a<sizeof(Wordarray);a++){
m=Wordarray[a];
[COLOR=red]printf("m=%s\n", m);[/color] /*<<< if I comment this line it runs */
}
return 0;
}
void copy1( char *s1, const char *s2 )
{
int i; /* counter */
/* loop through strings */
for ( i = 0; ( s1[ i ] = s2[ i ] ) != '\0'; i++ ) {
; /* do nothing in body */
} /* end for */
} /* end function copy1 */
What am I doing wrong?
DougP
< I Built one