Skip to main content

Basics of Programming In C || Sesion 1 & 2




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: 


4) How to write Comments in Programming  ?
Ans: for single line u can use this forward slash

u have to write 2 times like this //
// a = 20; //Line 1

if u want to comments in multiple line u have to use /* and *\



Comments

Popular posts from this blog

Python Final Lectures

 Q- how to Print Hello World print("Hello World") Variables in python ------- age = 30   #variable should be intutive so that we can learn any time print(age) Note: Shift+Enter is shortcut to run command 2) ' #' this is for writing the comment in python Rules for Variables--- Variable can not be start with any number like - 1age  Number can use in between and end with variable like - age1 age2 Special characters are not allowed expect _ (underscore) like - age_my Space not allowed in variable  Python is case sensitive  Way to define Variable --- age1,age2 = 30,25  age1 = 30 age2 = 25 age1=age2=30   #if 30 age for both variable   >> Data type the type of data is basically data type Integer = age1 to age3 is basically integer   , Integer is basically full number lets check = type(age1)  #it will give u print int float=  basically decimal values Interest =  30.24 type(Interest) #answer is float Message = ...

Add CSS using external CSS

>>> U just need to create a another page and save it with the name style.css >>> and then go to link that style page with your html docs how to link your css with html page ? >>> You can find code below , it will help you to link your external page with your html docs <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Divyanshu Khare || MERN Developer</title> <meta description = "description" content="Divyanshu Khare's website"> <link rel="stylesheet" type="text/css" href="style.css">   <!----------link external css page ---------> </head> <body> </body> </html>

Python

Indexing--  it will help u to fetch single character  string= "Python" string[2] # slicing process of fetching a sub-string from the given string  #sequence of charater we can fetch means more than 1 character string="Divyanshu" string[2:4+1]   #basically here number is index value #string[start_index:end+index+1] string = "Hunny"   #indexing agr positive hai to left se count hoga #right se negative me string[:]  #it will give u entire string #now If i want to any characterwise index like string is Hunny and I want un only #string[start_index:end_index+1:step] string[1:4:2] #reverse your string #string[:: -1] string="Baba hunny" string[:: -1] # to convert into lowecase string="New Divyanshu" new_string=string.lower()  #new_string becase we've to create another string print(new_string) s1={1,2,3,4,5}    s2={3,2,8,67,85} s3=s1.union(s2) s3   #isme add hota hai whole value lekin common value update nhi hongi #intersection - ...