1 / 165

First Program in C With Output

First Program in C With Output. C Language Keywords. Variables In C. Initialize int value in declaration. Using a variable to store value. Meaningful variable name. Define three variables and use assignment operator to assign value.

ferris
Télécharger la présentation

First Program in C With Output

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. FirstProgram in C With Output

  2. C Language Keywords

  3. Variables In C

  4. Initialize int value in declaration

  5. Using a variable to store value

  6. Meaningful variable name

  7. Define three variables and use assignment operator to assign value • intmain()     {  intterm;       /* term used in two expressions */ intterm_2;     /* twice term */ intterm_3;     /* three times term */         term = 3 * 5;          term_2 = 2 * term;         term_3 = 3 * term; return (0);    }

  8. Use printf to output variable

  9. Printing Variable Contents

  10. Finding the limits

  11. #include <stdio.h>      #include <limits.h>   #include <float.h>    intmain(void){printf("Variables of type char store values from %d to %d", CHAR_MIN, CHAR_MAX);printf("\nVariables of type unsigned char store values from 0 to %u", UCHAR_MAX);printf("\nVariables of type short store values from %d to %d", SHRT_MIN, SHRT_MAX);printf("\nVariables of type unsigned short store values from 0 to %u",USHRT_MAX);printf("\nVariables of type int store values from %d to %d", INT_MIN, INT_MAX);printf("\nVariables of type unsigned int store values from 0 to %u", UINT_MAX);printf("\nVariables of type long store values from %ld to %ld", LONG_MIN, LONG_MAX);printf("\nVariables of type unsigned long store values from 0 to %lu", ULONG_MAX);printf("\nVariables of type long long store values from %lld to %lld", LLONG_MIN, LLONG_MAX);#include <stdio.h>      #include <limits.h>   #include <float.h>    intmain(void){printf("Variables of type char store values from %d to %d", CHAR_MIN, CHAR_MAX);printf("\nVariables of type unsigned char store values from 0 to %u", UCHAR_MAX);printf("\nVariables of type short store values from %d to %d", SHRT_MIN, SHRT_MAX);printf("\nVariables of type unsigned short store values from 0 to %u",USHRT_MAX);printf("\nVariables of type int store values from %d to %d", INT_MIN, INT_MAX);printf("\nVariables of type unsigned int store values from 0 to %u", UINT_MAX);printf("\nVariables of type long store values from %ld to %ld", LONG_MIN, LONG_MAX);printf("\nVariables of type unsigned long store values from 0 to %lu", ULONG_MAX);printf("\nVariables of type long long store values from %lld to %lld", LLONG_MIN, LLONG_MAX);

  12. printf("\nVariables of type unsigned long long store values from 0 to %llu", ULLONG_MAX);printf("\n\nThe size of the smallest non-zero value of type float is %.3e", FLT_MIN);printf("\nThe size of the largest value of type float is %.3e", FLT_MAX);printf("\nThe size of the smallest non-zero value of type double is %.3e", DBL_MIN);printf("\nThe size of the largest value of type double is %.3e", DBL_MAX);printf("\nThe size of the smallest non-zero value of type long double is %.3Le", LDBL_MIN);printf("\nThe size of the largest value of type long double is %.3Le\n", LDBL_MAX);printf("\nVariables of type float provide %u decimal digits precision.",  FLT_DIG);printf("\nVariables of type double provide %u decimal digits precision.",  DBL_DIG);printf("\nVariables of type long double provide %u decimal digits precision.", LDBL_DIG);return 0;}printf("\nVariables of type unsigned long long store values from 0 to %llu", ULLONG_MAX);printf("\n\nThe size of the smallest non-zero value of type float is %.3e", FLT_MIN);printf("\nThe size of the largest value of type float is %.3e", FLT_MAX);printf("\nThe size of the smallest non-zero value of type double is %.3e", DBL_MIN);printf("\nThe size of the largest value of type double is %.3e", DBL_MAX);printf("\nThe size of the smallest non-zero value of type long double is %.3Le", LDBL_MIN);printf("\nThe size of the largest value of type long double is %.3Le\n", LDBL_MAX);printf("\nVariables of type float provide %u decimal digits precision.",  FLT_DIG);printf("\nVariables of type double provide %u decimal digits precision.",  DBL_DIG);printf("\nVariables of type long double provide %u decimal digits precision.", LDBL_DIG);return 0;}

  13. OUTPUT

  14. Finding the size of a type

  15. Scope of variables

  16. value of i is 1 the value of i is 10 The Value of i is 1 The Value of i is 10

  17. Inner variable shadows outer variable

  18. Output

  19. Declare global variables

  20. Define and use Global variables

  21. Local variable shadows global variable.

  22. Static variable

  23. Output

  24. Static versus automatic variables

  25. Output address and value

More Related