可能性の重複:私はC.内の別の文字に文字列の文字を変更しようとしているので、
Problem with processing individual strings stored in an array of pointers to multiple strings in CCプログラミング - 文字列配列要素の変更文字
[OK]をつまり、各文字列は1D配列の要素なので、文字列自体が文字配列なので、本質的にすべて一緒に2次元配列になります。とにかく私はこれを行うコードを作成する問題があります。これも可能ですか?どんな助けもありがとうございます。ここで
はコードです:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
int i, size;
char **a;
a=(char**)malloc(sizeof(char*));
printf("Enter the size of the array:");
scanf("%d", &size);
for(i=0;i<size;i++){
a[i]=(char*)malloc(sizeof(char)*8);
}
a[3]="Read";
while(*(a[3])!='\0'){
if(*(a[3]) == 'e'){
*(a[3]) = 'r';
}
}
printf("%s\n", a[3]);
system("pause");
return 0;
}
正確な問題は何ですか?あなたは言わなかった。間違いはありますか? –