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

Clique in Graph

Clique in Graph In this tutorial, we will learn about the clique in the graph theory. Clique In graph theory, a clique is a subset of vertices of an undirected graph such that every two distinct vertices in the clique are adjacent. Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

Equations

In general we frame real life problems into some mathematical formula called equations in which we use constant and some variables(unknown) Example: Ram is 12 years old.Ram 's age is 3/5 of Shyam's age what is Shyam's age. Let Shyam's age is x then 3/5 of sham's age is 3*x/5 x*3/5=12 x=60/3=20 so Shyam's age is 20. Linear equations When there is a linear combination of unknown variables is there then eqn is linear Example: 3x+ 2y+ 4z=9 Non Linear Equations: Equations in which non linear combination of the variable is there then eqn is non linear. When any 2 unknown variable multiplication present in the equation then it is the nonlinear equation. Example: 2x+5yz=98 is a nonlinear equation because yz multiplication is there: Quadratic equation in one variable: x^2 + 4*x + 2=0 is non linear because unknown variable x is being multiplied in term x^2 Quadratic equation in many variable: x^2 + y^2 +z^2 + w=0 cubic equati...

Practice Problem on Square Measurement

Practice Problem on Square Measurement What is the area of square having side length 5 unit? 25 unit 2     10 unit 25 unit 10 unit 2 What is the  perimeter of a square   having side length 5 unit? 20 unit 20 unit 2 10 unit 10 unit 2 What is the  diagonal  length of a square   having side length 5 unit? 5√2 unit     5√2 unit 2 10 unit 10 unit 2 What is the side length of square having area equal to  25 unit 2  ? 5 unit 5  unit 2 10 unit 10  unit 2 There is a petrol pump in a area having length and width equal to 500 meter. What will be cost to put bricks in the whole area if bricks having length and width equal to 5 cm and cost of 1 bricks is Rs 5? Rs 500000000 Rs 50000000 Rs 5000000 Rs 500000 Related Post:  Square Mensuration Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above. ...

Vertex Cover

Vertex Cover In this tutorial, We will learn about the vertex cover in graph theory. Vertex Cover  A vertex cover of an undirected graph is a subset of its vertices such that for every edge (u, v) of the graph, either u or v is in vertex cover i.e minimum number of vertices that covers all edges of the given graph. Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.