Getting Started With C

Assigning Values to Variables

In C programming, variables are used to store data that can be manipulated and used in the program. There are several types of variables in C, including:

  1. Integers (int):
  2. Used to store whole numbers, both positive and negative, without any decimal points. For example,
                int age=30;

  3. Floating-point numbers (float and double):
  4. Used to store numbers with decimal points. float is a single-precision floating-point number, while double is a double-precision floating-point number, providing more precision. For example,
     float pi = 3.14;

  5. Characters (char):
  6. Used to store single characters, enclosed in single quotes. For example,
    har grade = 'A';

  7. Arrays:
  8. Used to store a collection of elements of the same type. For example,
                    int numbers[5] = {1, 2, 3, 4, 5};
                

  9. Pointers:
  10. Variables that store memory addresses. They can point to other variables or functions. For example,
                    int *ptr = &age; 
                

  11. Structures:
  12. Used to group variables of different types under a single name. For example,
                    struct Person { char name[50]; int age; };
                

  13. Unions:
  14. Similar to structures but can store only one value at a time. For example
                    union Data { int i; float f; char str[20]; };
                

Resources :

Featured
Special title treatment

With supporting text below as a natural lead-in to additional content.

Q1. What is the output of this program?

Program.c


Q2. What is the output of this program?

Program.c