It is a type declaration. They are defined to be unsinged 'u' and contain exactly 8 and 16 bits.
On an Arduino Uno, a 'byte' data type is the same as uint8_t and an unsigned int is the same as a uint16_t;
It is a method for specifying excactly how large you want a variable that makes sure it is the same across different platforms
and this:
2. what is this code?
uint16_t free_ram(void)
{
extern int __bss_end;
extern int *__brkval;
uint16_t free_memory;
It is a function that reports how much free memory the processor has at that moment
3.what is avr/wdt.h? #include <avr/wdt.h>
it is the Watchdog Timer. Google is your friend here.
4.whether I can get the definition of (AVR_ATmega328P) #if defined (AVR_ATmega328P) || defined (AVR_ATmega328) // Arduino Uno hardware I2C pins
It is a compile type constant the changes depending on what board type you select. This allows code to change based on the differences between different processors. The exact value is not important, just the fact that it is defined or not. You could always put it into a Serial.print() statement to see.