1) About Variables In programming C.
Ans:
What is Variable: C programming me, "variables" wo placeholders hote hain jahan par aap data store karte hain. In variables me aap numeric values, characters, strings, aur doosre data ko store kar sakte hain. Variables ke use se aap program me data ko manipulate aur process kar sakte hain.
- In Simple term Variable kisi v container ka rkha gya name hota hai, Suppose ham apne gharo me Sugar, Masale etc steel ke container me store kar rhe hai aur uske upar ek label lga rhe us label me hamne sugar likh diya to ab ye label jisme sugar likha hai wo likha hua name programming ki terms me Variable kehlata hai .
- U can say variable is the name of a Memory.
C programming me, aap variables ko declare karte hain, jisme aap unka data type aur naam specify karte hain. Kuch common data types hain:
1. `int`: Integer values (pooray numbers) ko store karne ke liye, jaise `int age = 25;`.
2. `float`: Floating-point values (decimal numbers) ko store karne ke liye, jaise `float price = 19.99;`.
3. `char`: Single characters ko store karne ke liye, jaise `char grade = 'A';`.
4. `double`: Double-precision floating-point numbers ko store karne ke liye, jaise `double salary = 50000.75;`.
5. `char[]` ya `char*`: Strings ko store karne ke liye, jaise `char name[] = "John";` ya `char* name = "John";`.
2) Rules of Variables in Java .
Ans:
- Case Sensitivity: C programming me variable names case-sensitive hote hain, yani ki "myVariable" aur "myvariable" alag-alag variables hote hain.
- Variable Name (Naam): Variable ka naam alphabets (a-z, A-Z) se shuru hona chahiye ya underscore (_) se shuru ho sakta hai. Aap numbers (0-9) ka istemal variable naam ke beech me kar sakte hain, lekin variable ka naam number se shuru nahi ho sakta. Variable naam me koi special character (jaise @, $, %, etc.) istemal nahi kiya ja sakta hai.
- Reserved Words: Aap reserved words (jaise int, float, for, while, if, aadi) ko variable naam ke roop me istemal nahi kar sakte hain.
- Data Type: Variable ka naam data type ke sath match karna chahiye. For example, ek integer variable ko "intCount" jaisa naam dena behtar hai.
3) what is Keywords in Programming c ?
Ans: C programming me, keywords ya reserved words special words hote hain jo programming language me predefined hoti hain aur specific tasks ko perform karti hain. Ye words aapko apne program me variable names ya function names ke roop me use nahi karne chahiye, kyunki ye pehle se define ki gayi hain aur inka specific meaning hota hai. Kuch common C programming keywords hain:
1. `auto`: Variable ko automatic storage class mein declare karne ke liye.
2. `break`: Loop ko todkar bahar nikalne ke liye.
3. `case`: Switch statement ke case ke liye.
4. `char`: Character data type ke liye.
5. `const`: Constant value ko declare karne ke liye.
6. `continue`: Loop ki current iteration ko chhodkar next iteration me jana ke liye.
7. `default`: Switch statement ke default case ke liye.
8. `do`: Loop ki shuruaat me ek block of code ko execute karne ke liye.
9. `double`: Double-precision floating-point data type ke liye.
10. `else`: If statement ke alternative block of code ke liye.
11. `enum`: Enumeration type define karne ke liye.
12. `extern`: External variable declare karne ke liye.
13. `float`: Floating-point data type ke liye.
14. `for`: Loop ke liye.
15. `goto`: Code me specific label par jana ke liye.
16. `if`: Conditional statement ke liye.
17. `int`: Integer data type ke liye.
18. `long`: Long integer data type ke liye.
19. `register`: Register storage class mein variable declare karne ke liye.
20. `return`: Function se value return karne ke liye.
21. `short`: Short integer data type ke liye.
22. `signed`: Signed data type specifier.
23. `sizeof`: Variable ya data type ki size (bytes) nikalne ke liye.
24. `static`: Static storage class mein variable declare karne ke liye.
25. `struct`: User-defined structure define karne ke liye.
26. `switch`: Multi-way decision making ke liye.
27. `typedef`: New data type define karne ke liye.
28. `union`: Union data type define karne ke liye.
29. `unsigned`: Unsigned data type specifier.
30. `void`: Kuch nahi (return type undefined) ke liye.
31. `volatile`: Variable ka value kabhi bhi badal sakta hai, isiliye compiler optimization ke liye ignore nahi kiya jata
32. `while`: Loop ke liye.
In keywords ka istemal program structure, decision making, loops, data types, functions, aur storage classes ke liye hota hai. Aap in keywords ka istemal apne C program me karte hain taki aap code ko define aur control kar saken.
3) Program Structure of C.
Ans:
Ans: for single line u can use this forward slash
u have to write 2 times like this //
Comments
Post a Comment