Oh, and here's your problem:
Code:
sarray[i]=string[0] + i;
string[0] returns the character at the beginning of the string, you need to use plain string, which is the address of the char array.
try:
Code:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(void)
{
printf("s \n");
char **sarray;
int i, n = 10;
sarray = (char **)malloc(n * sizeof(char *));
char *string = "lhfsadgfbfsdaubsdkj";
printf("s - \n");
for(i=0;i<n;i++){
sarray[i]=string + i;
}
printf("s\n");
for(i=0;i<n;i++){
printf("%s - ",sarray[i]);
}
}