嗨,我想设置一个指向数组第n个字符的指针:
// create pointer
char *originalPointer;
// malloc an arrary of 10 chars
originalPointer = (char *) malloc(10);
// create new pointer
char* setPtrAsNthCharOforiginalPointer;
// **** how to set it to the nth spot of ****
setPtrAsNthCharOfOriginalPointer = &originalPointer + 4;
最佳答案
删除地址运算符
too_long_name = originalPointer + 4 ;