C
Chad
What's the difference between using some like struct node* current as
a temporary variable in the following function...
int Length(struct node* head) {
struct node* current = head;
int count = 0;
while (current != NULL) {
count++;
current = current->next;
}
return count;
}
As opposed to not using one in the same function....
int Length(struct node* head) {
int count = 0;
while (head != NULL) {
count++;
head = head->next;
}
return count;
}
Or wouldn't it matter in this case?
a temporary variable in the following function...
int Length(struct node* head) {
struct node* current = head;
int count = 0;
while (current != NULL) {
count++;
current = current->next;
}
return count;
}
As opposed to not using one in the same function....
int Length(struct node* head) {
int count = 0;
while (head != NULL) {
count++;
head = head->next;
}
return count;
}
Or wouldn't it matter in this case?