J
jhagens14
The following program compiles successfully on a Microsoft Visual C++
6.0 compiler but when I execute it..it encounters an unknown
error..may be a because of a seg fault..
#include <string.h>
#include <iostream.h>
int main(int argc, char **argv){
int i;
int len;
char *addressLine[8];
addressLine[1] = "String1";
addressLine[2] = "String2";
for(i = 1; i <= 8; i++){
len = strlen(addressLine);
if (len >= 1){
cout << "Address: " << addressLine;
cout << "\n";
}
}
return (0);
}
but when I just use the following without the loop..
cout << "Address: " << addressLine[1];
it just works fine...
Please help!...
6.0 compiler but when I execute it..it encounters an unknown
error..may be a because of a seg fault..
#include <string.h>
#include <iostream.h>
int main(int argc, char **argv){
int i;
int len;
char *addressLine[8];
addressLine[1] = "String1";
addressLine[2] = "String2";
for(i = 1; i <= 8; i++){
len = strlen(addressLine);
if (len >= 1){
cout << "Address: " << addressLine;
cout << "\n";
}
}
return (0);
}
but when I just use the following without the loop..
cout << "Address: " << addressLine[1];
it just works fine...
Please help!...