Skip to main content

OFFSET in Computer Science

OFFSET in Computer Science

In the post, We will understand what is the meaning of OFFSET in computer science with an example.
In computer science offset comes picture at may place like packing a data structure, encoding the data etc in some standard protocol so that other parties can deserialise it and understand the data. We will understand its important how does it work with example. suppose we have a data structure for a student like
 {  
 name:string[20]  
 roll: int[4]  
 course: string[25]  
 batch: int[4]  
 }  

We want to serialise below student data 
 {  
 name:"Amit Gupta"  
 roll: 1234  
 course:Computer Science"  
 batch: 2018  
 }  
Our protocol follow the rule that we will insert a value and if space will remain empty we will fill it with $ for example length of "Amit Gupta" is 10 but standard size is 20 so will fill 10 $ after "Amit Gupta". So serialisation of above data will be
 Amit Gupta$$$$$$$$$$1234Computer Science$$$$$$$$$2018  
So according to our data structure
  • OFFSET of name will be zero and length will 20
  • OFFSET of roll will be 20 and length will 4
  • OFFSET of course will be 24 and length will 25
  • OFFSET of batch will be 49 and length will 4
So from above you can clearly say that OFFSET of any variable or character is number of character before it.
Now for example we can encode it into base64 before sending it third party. So base64 encoding of above string will be
 IEFtaXQgR3VwdGEkJCQkJCQkJCQkMTIzNENvbXB1dGVyIFNjaWVuY2UkJCQkJCQkJCQyMDE4ICA=  
Other can decode it and now he know how to deserialise because of protocol definition from 0 to 20 character he will consider as name and ignore the $ symbol next 20 to 24 as roll, 24 to 49 as course and 49 to 53 as batch.


Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above. 

Comments

  1. This post will prove very useful for computer science students. My sister is also a computer science student. I will definitely share this post with her. In-spite of it, she is doing her preparation from typical student. Whenever she has doubts in any subject she immediately visit the site and get solutions from there.

    ReplyDelete
    Replies
    1. Thanks a lot. We will be posting more great educational blogs in near future.

      Delete
  2. Thank you so much for post. It is really help full. If any one want to know about R-Programming Language.
    R Programming training Center in Delhi/NCR

    ReplyDelete
  3. Thanks for sharing information with us,I would appreciate if you could share more information about software courses
    e accounting training course in delhi

    ReplyDelete
  4. Hi I have tried it before but I made an error. You write correctly that "OFFSET of roll will be 20 and length will 4" I used the length 5 instead of 4. You are awesome. Keep it up. Thanks for writing.

    ReplyDelete
  5. Your blog provided us with valuable information to work with. Thanks a lot for sharing. Outsource support increased expertise, Expand resource and Efficiency. For the Outsource support you can visit on outsourced hosting support

    ReplyDelete
  6. Thanks for sharing the valuable post. To get to know about off page optimization plz vist the below link
    Digital Marketing Training in Chennai

    ReplyDelete
  7. Quite informative blog .One could easily get into Aviation Domain with Degree in Computer Science. Multiple Aviation Courses are available to get into Aviation industry.
    Aviation Training in Chennai
    Airport Ground Operations Training
    Cabin Crew Training In Chennai
    Pilot Training In Chennai
    Flight Dispatcher Training In Chennai

    ReplyDelete
  8. There is lots of post about SAP But Your Post way of Writing and knowledgeable information is So Good and Unique. Keep Writing
    Sap Training Course in Delhi
    Sap Training Course in Noida
    Sap Training Course in Gurgaon

    ReplyDelete
  9. This is an awesome post. Really very informative and creative contents. I really appreciate your post. Thanks for sharing it. To Know More Visit Here: Rajendra Geda

    ReplyDelete
  10. Ascend Aviation Pilot training program. Ascend aviation is the pinnacle of aviation training cum placement assistance institution located in southern part of india. Click on link below, To know more about our programs .
    Aviation Course in Chennai
    Airport Ground Operations Training
    Cabin Crew Training In Chennai
    Pilot Training In Chennai
    Flight Dispatcher Training In Chennai
    Aviation Training in Chennai
    Air hostess training
    Aviation Academy in Chennai

    ReplyDelete
  11. it's really a piece of new information to me, I learn more from this blog, I want to learn more from this blog, keep on it doing, I eagerly waiting for your updates, Thank you!!!

    Best Aviation Academy in Chennai

    Best Air hostess Training in Chennai

    Pilot Training in Chennai

    Airport Ground Handling Training in Chennai

    Airport Flight Dispatcher Trainee in Chennai

    RTR- Aero Training in Chennai

    For more... facebook

    ReplyDelete
  12. I read Your Post about E-accounting and I must say it is really one of the finest Post. It’s really unique and knowledgeable information
    E-accounting training in Delhi
    E-accounting training in Noida
    E-accounting training in Gurgaon

    ReplyDelete
  13. This app explains the importance of why you need to update any application over time. You can opt for quality mobile app maintenance online for a wide range of information.

    ReplyDelete
  14. it was a wonderful chance to visit this kind of site and I am happy to know. thank you so much for giving us a chance to have this opportunity.. This is the exact information I am been searching for, Thanks for sharing the required infos with the clear update and required points.



    Dot Net Training in Chennai | Dot Net Training in anna nagar | Dot Net Training in omr | Dot Net Training in porur | Dot Net Training in tambaram | Dot Net Training in velachery





    ReplyDelete

Post a Comment

Popular posts from this blog

Time, Speed and Distance

Time, Speed And Distance  In this post, We will learn about time, speed and distance. Important Formula Distance = Time x Speed Time = Distance/Speed Speed = Distance/time Important Units Distance: meter (m), kilometre (km) Time: Hour (h), second (s) speed: meter/second (m/s), kilometre/hour  (km/h) Important Conversion 1 km = 1000 meter 1 h = 3600 s 1 km/h = (5/18) m/s 1 m/s = (18/5) km/h Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above. 

Joint Entrance Exam (JEE): Probability Syllabus

JEE: Probability Syllabus Probability  is a very interesting and different topic of mathematics which doesn't require your previous knowledge of any other chapters other than permutation and combination.  Following topics are the part of Jee syllabus Addition and multiplication rules of probability Addition and multiplication rules of probability Conditional Probability Bayes Theorem Independence of events Computation of probability of events using permutations and combinations Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

Haryana Public Service Commission: HPSC 2018

Haryana Public Service Commission: HPSC 2018 Company Name         :  Haryana Public Service Commission: HPSC 2018 Recruitment Post Name                       :   Civil Judge State                            :  Haryana Salary                           :  Rs   27,700-44,770 Number of Vacancy   :  107 Eligibility                     :  Bachelor's Degree in Law Last Date to Apply     :  30-09-2018 Application Details    :  Notification Apply Online              :  Apply Here Government Jobs In  Haryana Please write comments if you f...

Securities and Exchange Board of India Recruitment 2018

Securities and Exchange Board of India  Company Name SEBI Post Name Assistant Manager State India Salary RS 28150-55600 Number of Vacancy 120 Eligibility Graduation Last Date 07-10-2018 Application Details Job Notification Apply Online Job Application Securities and Exchange Board of India (SEBI) Recruitment 2018    Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.