Breaking

शुक्रवार, 3 अप्रैल 2020

BCA-2nd Sem Notes -Accessing field Structure in C

  • UNIT-I (Array)
Definition
Declaration & initialization of 1D 
Accessing array elements
Displaying array elements
Sorting arrays
Arrays and function
Declaration & initialization of 1D
Accessing and Displaying
Memory representation of array [Row Major, Column Major]
Multidimensional array



  • UNIT-II (Pointers)
  • Definition

    Declaration & initialization
    Indirection operator
    address of operator
    pointer arithmetic
    dynamic memory allocation
    arrays and pointers
    function and pointers




  • UNIT-III (Strings)

  •   strlen(),strcpy(),       strcat() ,strcmp()



  • UNIT-IV (Structures)
  • Definition



  • UNIT-V                                     (C Pre-processor)




  • UNIT-VI                                (File Handling)


  • Definition of Files,
    Opening modes of files
    Standard function
    fopen(), fclose(),             feof()  fseek(),                    fewind()
    Using text files
    fgetc(), fputc(), fscanf()

      Accessing field 

    Accessing data fields within structs

    The dot operator ( period ) is used to access named fields within struct variables:

              john.nClasses = 4;
    
              totalGPA += sue.gpa;
    
    
    
    
    How to access structure elements? 
    Structure members are accessed using dot (.) operato
    #include<stdio.h>
      
    struct Point
    {
       int x, y;
    };
      
    int main()
    {
       struct Point p1 = {0, 1};
      
       // Accessing members of point p1
       p1.x = 20;
       printf ("x = %d, y = %d", p1.x, p1.y);
      
       return 0;
    }
    Output:
    x = 20, y = 1
    

     Previous Page  Print Page
    Next Page  
    Advertisements

    कोई टिप्पणी नहीं:

    एक टिप्पणी भेजें