This are used to represent fixed values that do not change / modifie during the program's execution time
#include <stdio.h> int main() { const int age = 23; printf(" Age : %d\n", age); return 0; }
#include <stdio.h> int main() { const int age = 20; age = 15; //error we can't change the constant printf("%d\n", age); return 0; }
Variables are the data name that we use to store data
#include <stdio.h> int main() { // Declares an variables & assigns values. int age; float salary; char grade; age = 30; salary = 5000.5; grade = 'A'; // Printing assigned values . printf("Age: %d\n", age); printf("Grade: %c\n", grade); printf("Salary: %.2f\n", salary); return 0; }
Age: 30 Grade: A Salary: 5000.50
#include <stdio.h> int main() { const int age = 23; printf("ವಿದ್ಯಾರ್ಥಿಯ ವಯಸ್ಸು : %d\n", age); return 0; }
#include <stdio.h> int main() { const int age = 23; age = 26; //error we can't change the constant printf("ವಿದ್ಯಾರ್ಥಿಯ ವಯಸ್ಸು %d\n", age); return 0; }
#include <stdio.h> int main() { //age & salary ಡೇಟಾವನ್ನು ಸಂಗ್ರಹಿಸಲು ಬಳಸುವ ಹೆಸರೇ ವೇರಿಯಬಲ್ . int age; float salary; age = 23; fee = 100000; // Printing assigned values . printf("ವಿದ್ಯಾರ್ಥಿಯ ವಯಸ್ಸು : %d\n", age); printf("ವಿದ್ಯಾರ್ಥಿಯ ಶುಲ್ಕ: %.2f\n", fee); return 0; }
Padma
@2022, Padma Education.
We cannot warrant full correctness of all content, we try to give our best. While using Padma education website, you agree to have read and accepted our terms and Conditions , privacy policy.