Quero entende porque isto funciona
char c[30] = "testing";
char *p;
*p = c[6];
printf("%c - %c", c[6], *p);
//> g - g
Porém isso da esse erro
char c[30] = "testing";
char *p = c[6];
printf("%c - %c", c[6], *p);
//>warning: initialization makes pointer from integer without a cast [-Wint-conversion]
// char *p = c[6];
// ^
E também porque nesse caso aqui não consigo passar um char pro ponteiro
void foo(char *s){;}
int main(){
char c[30] = "testing";
foo(c);}// ou foo("g")
//Isso funciona
void foo(char *s){;}
int main(){
char c[30] = "testing";
foo(c[6]);}// ou foo('g')
//Isso não funciona
//Para foo(c[6]);
//warning: passing argument 1 of 'foo' makes pointer from integer without a cast [-Wint-conversion]
// foo(c[6]);
// ^
//note: expected 'char *' but argument is of type 'char'
// void foo(char *s){
// ^~~
//Para foo('o');
//warning: passing argument 1 of 'foo' makes pointer from integer without a cast [-Wint-conversion]
// foo('o');
// ^~~
//note: expected 'char *' but argument is of type 'int'
// void foo(char *s){
// ^~~
Foi mal se tá mal formatado e se a pergunta é *****