-4

I have pointer like this => char* str={"you","we","they"};

I want to take 'we' or "they" .how is it posible ?

can you sy something about pointer ?

Paul R
  • 208,748
  • 37
  • 389
  • 560
harun eroğlu
  • 21
  • 1
  • 4

1 Answers1

2

It seems that you mean something like the following

char *str[] = { "you", "we", "they" };

for ( size_t i = 0; i < sizeof( str ) / sizeof( *str ); i++ )
{
    puts( str[i] );
}

Or

char *str[] = { "you", "we", "they" };

for ( size_t i = 0; i < sizeof( str ) / sizeof( *str ); i++ )
{
    for ( char *p = str[i]; *p != '\0'; ++p ) putc( *p );
    printf( "\n" );
}
Vlad from Moscow
  • 301,070
  • 26
  • 186
  • 335