For these declarations, which choice shows four equivalent ways to assign the character “y” in the string to a char variable c?

Advertisement

char buff[50] = “strings as arrays of characters are fun!”
char *str = buff+11;
char c;

  • A
    c = buff[16];
    c = str[5];
    c = *(buff+16);
    c = *(str+5);
  • B
    c = *(buff[15]);
    c = *(str[4]);
    c = buff+15;
    c = str+4;
  • C
    c = buff[15];
    c = str[4];
    c = *(buff+15);
    c = *(str+4);
  • D
    c = *(buff[16]);
    c = *(str[5]);
    c = buff+16;
    c = str+5;
Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.

Leave a Comment


Share via
Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.

Send this to a friend