Q. What is the Difference between __c and __r?
Ans:
__c is for Custom objects For example: Custom_Object__c . It is used for reference custom object in Apex or visualforce page, formula field etc internally. Used as suffix.
__r is for Custom objects reference For example: Custom_Object__r . It is used for reference custom object relation ship name in Apex or visualforce page, formula field etc. Used as suffix.
For example:
If you have two custom objects, called Service__c and Service_Line__c, where the Service Line has a field that references a Service as its parent, you can query from child to parent, or parent to child.
The child to parent relationship query looks like this:
SELECT Id, Service__c, Service__r.Name FROM Service_Line__c
While the parent to child relationship looks like this:
SELECT Id, Name, (SELECT Id, Name FROM Service_Lines__r) FROM Service__c