EECS 280 Lecture Notes - Lecture 8: Entry Point, Toro Rosso Str2, Null Character
Document Summary
//manually put the null character in this case then there would actually be one displated in the strings when it sees the null character it knows it"s the end of the array, it"s a sentinal (signal) ++ptr; //increment pointer return ptr - str; //take difference to see how many steps we took does not count the null character. //gives us the number of fence pieces not fence posts, the number of spaces we had to move to get to the null char. //while(*src) src++; also works instead of the thing above because at the end of src there is a null character which would evaluate to false, and end the while loop. ++g -wall -werror -o1 -pedantic test. cpp -o test. #include int atoi(const char *s); converts ascii to int, returns the characters int value according to ascii legend write program named sum that adds up comand line arguments using argv and atoi.