[Dev-C++] copying elements to an array of pointers...
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: senem b. <sbe...@ya...> - 2002-10-27 12:01:42
|
got a question:
i'd like to copy a char string to a string of pointers but i can't get the code working...and i can't see the result with cout... anyone who can help me??
kind regards,
senem
#include <iostream.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#define max 5
int main(){
char *array[max];
char string[max];
cout<<"enter string :";
cin.getline(string,max);
strncpy(array[0],string,sizeof(string)/sizeof(char));
cout<<array[0];
return 0;
}
---------------------------------
Do you Yahoo!?
Y! Web Hosting - Let the expert host your web site |