How to get only the single char in char*

  • Thread starter Thread starter Shahzaib17
  • Start date Start date
S

Shahzaib17

Guest
i have a char* in which i wan to store only a single char coming from a char named NEW_DRIVE_LIST

now issue is that with below mentioned way i am getting correct first element from NEW_DRIVE_LIST but its also adding extra

0000 after the value of NEW_DRIVE_LIST

char *b ;
b = &NEW_DRIVE_LIST;

what i want is this

char NEW_DRIVE_LIST='C';

char *b=NEW_DRIVE_LIST+":";

SO THAT i get b="C:" and not the extra garbage value

Continue reading...
 
Back
Top