Initialising function parameters
In a function definition, neither pointer or non-pointer formal parameters need to be initialised before runtime, correct? Is this standard? Can or should they be initialised anywhere in the program or is it unecessary? I read it is good practice to initialise all variables to zero or NULL if not assigning it a meaningful value straight away? Eg see comments: //No initialisation here void swap (int *num1, int *num2); int main() { int x = 25; int y = 100; printf("x is %d, y is %d\n", x, y); swap(&x, &y); // x&y both initialised before passing to swap() printf("x is %d, y is %d\n", x, y); return 0; } //num1&num2 not initialised? /**2 args are declared here when passed in but not needing initialisation? **/ void swap (int *num1, int *num2) { int temp; temp = *num1; *num1 = *num2; *num2 = temp; }